RynMan Posted October 5, 2009 Share Posted October 5, 2009 Hey guys I'm wondering how you would do the following.... Say I had a file such as a pdf stored on my server (and linked to it in my database), and it had an unusual filename (like an ID) - is there anyway I can still have the user download that file, but before they do, have the name of the file change to something more suitable? Thanks! Link to comment https://forums.phpfreaks.com/topic/176535-rename-file-before-downloading/ Share on other sites More sharing options...
pastcow Posted October 5, 2009 Share Posted October 5, 2009 You can use header("filename: bleh.txt"); then use readfile("actualfile.txt") to output the actual file Link to comment https://forums.phpfreaks.com/topic/176535-rename-file-before-downloading/#findComment-930581 Share on other sites More sharing options...
RynMan Posted October 6, 2009 Author Share Posted October 6, 2009 You can use header("filename: bleh.txt"); then use readfile("actualfile.txt") to output the actual file Thanks pastcow. Could you possibly put this into context? Just not sure how or where I'd put it. Link to comment https://forums.phpfreaks.com/topic/176535-rename-file-before-downloading/#findComment-931407 Share on other sites More sharing options...
trq Posted October 6, 2009 Share Posted October 6, 2009 Take a look at this force download snippet. Link to comment https://forums.phpfreaks.com/topic/176535-rename-file-before-downloading/#findComment-931421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.