haku Posted December 26, 2007 Share Posted December 26, 2007 I am building a site in which users in my company can upload files onto our server, and download them as well. However, as I am working in Japan, the file names are often in Japanese. I have found that this doesn't bode so well for the server we use, so I have worked around this by changing the file name to a digit when it is uploaded, then storing a reference in a mysql database that matches the filename to the original Japanese name. However, this has left me with the problem that when the user downloads the file onto their computer, rather than seeing japanesefilename.extension, they see digit.extension. I know its possible to change the filenames as files are uploaded onto the server (Im already doing it), but is it possible to change the filename as files are downloaded to the client? If so, can someone point me in the right direction on how to do that? Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/83215-change-file-name-for-download/ Share on other sites More sharing options...
Daniel0 Posted December 26, 2007 Share Posted December 26, 2007 See: http://www.phpfreaks.com/forums/index.php/topic,95433.0.html Quote Link to comment https://forums.phpfreaks.com/topic/83215-change-file-name-for-download/#findComment-423324 Share on other sites More sharing options...
haku Posted December 26, 2007 Author Share Posted December 26, 2007 Thank you sir. Although, I don't really get it Where do I put this script? Quote Link to comment https://forums.phpfreaks.com/topic/83215-change-file-name-for-download/#findComment-423326 Share on other sites More sharing options...
Daniel0 Posted December 26, 2007 Share Posted December 26, 2007 You don't put it anywhere. You modify it and take out the things you need to fit your needs The important part for you is this: header( "Content-Disposition: attachment; filename=".basename($file)); It's a header which tells the browser that the file is to be downloaded and what the name of the file is. Quote Link to comment https://forums.phpfreaks.com/topic/83215-change-file-name-for-download/#findComment-423734 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.