Help - Search - Members - Calendar
Full Version: change download link filename
HTMLHelp Forums > Web Authoring > Web Site Functionality
hedehede
hi, im wordpress site manager and i using address link which if you open it file will be downloaded automatically
and i want when file is downloading change filename, problem is i didnt uploaded this file i just want to change file name when downloading, any code or something could help me?

pandy
No. Rename the file on the server.
Frederiek
I think it can be done. Try searching for "change filename on download".
pandy
I, maybe incorrectly, got the impression that server side wasn't an option.
Christian J
HTML5's DOWNLOAD attribute lets you specify a default file name, like this:

CODE
<a href="file.php?id=746345465400132761" download="foo.txt">download file</a>

Browser support is still limited: http://caniuse.com/#search=download

See also https://www.w3.org/TR/2014/REC-html5-201410...erlink-download
pandy
The behaviour is inconsistent even between the browsers it does work in. If the user chooses to rightclick and use Save link target as (or whatever the option is called) the latest FF will still rename the file whereas K-Mel (a few gecko versions behind) och Iron will not.
Christian J
Also it might feel a bit confusing/worrying to examine a file name in the statusbar, only to get an apparent different file once you open the link.
pandy
Yeah, that too. And I think most people would rightclick because that's what we are used too and how could they know this link is different if it doesn't explicitly say so on the page? Writing out "You don't need to rightclick this link to download the file. Just leftclick on it!" would be even more stupid than the old "Click here!".

I don't think I like this feature very much. ninja.gif
Themeaxe
This actually possible with JavaScript. Though browser support would be spotty. Google chrome is best for this solution.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.