hellonoko Posted October 23, 2008 Share Posted October 23, 2008 On my web site I am going to be storing files in a manner that makes them unrecognizable. For example: 9lj234lkj42l3kj.myextension or just: randomfilename.txt These names and their actual information will be stored in a data base as a reference to the file. When I display these files for download the actual link to the file will be something like http://www.mysite.com/files/lkj34hkj32432.txt but the link will display as Photo10.jpg as referenced from the database. So what I need to figure out how to do is make some kind of downloading script that changed the file name to the referenced name (Photo10.jpg) but only upon download. Link to comment https://forums.phpfreaks.com/topic/129685-changing-files-names-in-the-dialog-and-or-renaming-file-on-download/ Share on other sites More sharing options...
awpti Posted October 23, 2008 Share Posted October 23, 2008 Look into header(), you can generally use this to push content-type and force file naming on download. It's not an easy subject to cover, but it's not terribly difficult either. You could also steal the download helper/library from the CodeIgniter framework and adapt it for your own usage. It's an independent component and does not rely on CodeIgniter in any way. Link to comment https://forums.phpfreaks.com/topic/129685-changing-files-names-in-the-dialog-and-or-renaming-file-on-download/#findComment-672445 Share on other sites More sharing options...
hellonoko Posted October 23, 2008 Author Share Posted October 23, 2008 That may do the trick. I will play around with it thanks. Link to comment https://forums.phpfreaks.com/topic/129685-changing-files-names-in-the-dialog-and-or-renaming-file-on-download/#findComment-672450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.