Reputation: 730
I have a page http://example.com/1.html and on it I have a link http://example.com/1.mp4
<a href="http://example.com/1.mp4">Download</a>
which redirect to another link https://example.com/videoplayback?.... which plays the .mp4 file. In order to download the file without redirect I use the download attribute
<a href="http://example.com/1.mp4" download>Download</a>
and in order to set a name to the file I set a value to the download attribute
<a href="http://example.com/1.mp4" download="S1E1.mp4">Download</a>
Now when I click the link the file should start downloading with the name S1E1.mp4 but because the link redirect to another link the file name is "videoplayback". So how can I set the name of this file to be "S1E1.mp4". Thanks for everything. If my question is not clear leave a comment and I'll edit it.
Upvotes: 1
Views: 866
Reputation: 14279
The real Question is: Why do you redirect? I guess you're using htaccess? Then use a normal rewrite, not a redirect.
Edit:
Your PHP-Script should at least provide a Filename per header:
header('Content-type: -whatever type this is-');
header('Content-Disposition: attachment; filename="My-Super-Video.mp4"');
Upvotes: 1