wee493 Posted July 21, 2009 Share Posted July 21, 2009 I have an upload script that, well obviously lets you upload files. Once the file is uploaded the name is changed to the date,time,and second the file was uploaded to prevent from duplicate file names. The only thing is that users dont want to download a file called 09072015230.zip (the date is numeric). Is there a way for the server to "rename" the file so the client would download kittycat.zip instead of 09072015230.zip. I dont want the file to actually be renamed, just for the clients computer to download and save it as that. Quote Link to comment https://forums.phpfreaks.com/topic/166735-make-download-file-name-different-than-actual/ Share on other sites More sharing options...
trq Posted July 21, 2009 Share Posted July 21, 2009 See the force download script within the Code Snippet Repo board. Quote Link to comment https://forums.phpfreaks.com/topic/166735-make-download-file-name-different-than-actual/#findComment-879228 Share on other sites More sharing options...
wee493 Posted July 21, 2009 Author Share Posted July 21, 2009 See the force download script within the Code Snippet Repo board. That script is good, but can it change the name of the file you are set to download? I dont see how it would do that Quote Link to comment https://forums.phpfreaks.com/topic/166735-make-download-file-name-different-than-actual/#findComment-879253 Share on other sites More sharing options...
trq Posted July 21, 2009 Share Posted July 21, 2009 On this line... header( "Content-Disposition: attachment; filename=".basename($file)); you would specify the filename the users will receive. Quote Link to comment https://forums.phpfreaks.com/topic/166735-make-download-file-name-different-than-actual/#findComment-879265 Share on other sites More sharing options...
wee493 Posted July 21, 2009 Author Share Posted July 21, 2009 On this line... header( "Content-Disposition: attachment; filename=".basename($file)); you would specify the filename the users will receive. Thank You! I got it all working and setup Quote Link to comment https://forums.phpfreaks.com/topic/166735-make-download-file-name-different-than-actual/#findComment-879302 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.