I have a site where users are prompted to download files from external resources. Since the external file names are hashed and the user downloads multiple files, it's very hard for users to know which file they download reaches what resource they requested. For instance, the file name of fdae442dafe42.zip
could be production-resources.zip
.
I'm looking for ways to have it so the browser will download the file as a different name. Below are some of my ideas and why they won't work, but you may be able to find a workaround.
Just a note, I don't have any control over the external resource. I won't be able to make changes to the headers or anything else. My service is a website that mostly targets Desktop Users. Android and iOS solutions won't be that beneficial.
Download Attribute
This method was working for a while in Google Chrome and Firefox, but then they started to follow the W3 HTML5 spec. The external resource requires to send the header of Content-Disposition
in which Google Chrome and Firefox didn't check before.
PHP Proxy Download
I know that I could have a PHP script make a request to the external resource and then deliver it to the end user while changing the headers and name to fit my needs. The issue is the site has high traffic and each user downloads about 1-2GB of data. My servers are not able to handle this type of traffic and upgrading the server will probably be too costly.
Rename Files with External Application
I was considering using an external application (Possibly a Chrome / Firefox Extension) that will rename the files after they finish downloading. But considering a large enough of my audience are one time visitors, asking them to download an application or extension is very unlikely.
Flash or Java Embedded Solutions
I am considering using a Java or Flash embedded file that will handle the file downloads, but I don't know enough about either platform. From what I can tell, Flash doesn't have much control over the user's file system, so this could be an issue. Java will be able to do this task, but I was really hoping I wouldn't have to use Java since it's often insecure and requires a large download to install it (same issue as External Software idea).
If you have any ideas on what I could possibly do to solve this issue, they would be greatly appreciated. I'm not looking for any code, just ideas on how I will be able to accomplish the above task. I would like to thank you all for your time and expertise.