cesarcesar Posted May 4, 2007 Share Posted May 4, 2007 I have a php script that uploads a file to a directory. Since this program doesn't like spaces and crazy characters in the file name, the name gets changed to the current timecode (funky named-4.jpg to 1178253719.jpg). After the change i save both names to a db. This all works great. Next i have a page that reads the directory and displays the timecoded file name, when a user clicks it, it downloads fine. still works great. I would like to find a way to rename the file on download, to the old saved named of the file (1178253719.jpg to funky named-4.jpg). How can i do this? Thanks. Link to comment https://forums.phpfreaks.com/topic/49935-rename-file-on-download/ Share on other sites More sharing options...
trq Posted May 4, 2007 Share Posted May 4, 2007 File names should not contain spaces full stop. Why not just replace the spaces with _ ? Link to comment https://forums.phpfreaks.com/topic/49935-rename-file-on-download/#findComment-245107 Share on other sites More sharing options...
cesarcesar Posted May 4, 2007 Author Share Posted May 4, 2007 yes i could just rename. i had thought of this, also using regexp to strip with. i still would like to know if this question can be done. thanks Link to comment https://forums.phpfreaks.com/topic/49935-rename-file-on-download/#findComment-245133 Share on other sites More sharing options...
cesarcesar Posted May 4, 2007 Author Share Posted May 4, 2007 heres the fix. http://www.higherpass.com/php/Tutorials/File-Download-Security/ Link to comment https://forums.phpfreaks.com/topic/49935-rename-file-on-download/#findComment-245145 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.