Automatic file download page - can I change content?

Hi I am trying to specify a confirmation page for users when they successfully download something from my app.

Currently I have managed to get the download part working, getting a media object from a table calling a server side method from my client code:

‘’‘python
f = anvil.server.call(‘downloadTrue’) # returns a media object
anvil.media.download(f) # downloads the media object to the user’s browser in a new page
‘’’
Unfortunately the new page has a “download failed” message, which is wrong because I have no traceback of errors, also the file downloads perfectly.

I am wondering if anyone knows how to change that automatic page?

Can you provide a screenshot of the “automatic page” you’re talking about? I’ve not seen a new page when using anvil.media.download, so I’m guessing it’s something specific to your browser (or app). A clone link to an app replicating this behavior could also be helpful.

this is the download page:

I think that appears when your app tries to go to “your app’s URL + another URL”, which can happen if you omit the “https://” from the start of a link url.

Can you share a clone link to your app (or a simpler app that exhibits this behavior)? Or else show us the lines of code that last run before this appears?

In other words, I’m confident that it is not the anvil.media.download line that causes this page to appear. Instead, I’m guessing it is what you are doing to try to bring up a “confirmation page” after the download that is causing this.

I intend to get back to you on this.
Thanks for your kind attention to my issue.

1 Like