allasso Posted January 26, 2009 Share Posted January 26, 2009 Hello, I posted this on dev net but thought I would post here as well. I would like for to be able to allow a client have the option to download multiple files as attachments with one request, eg, the client clicks a link on a page, or submit button, and several file download dialog boxes appear. I have tried, <?php $type_ = EZ_ ; header('Content-type: text/html'); header("Content-Disposition: attachment; filename=file_$type_.html"); readfile("file_$type_.html"); $type_ = prod_ ; header('Content-type: text/html'); header("Content-Disposition: attachment; filename=file_$type_.html"); readfile("file_$type_.html"); ?> but it only does the first request. I have tried many other things as well. Any ideas? Or anything outside of PHP that will work? I have done much searching and experimenting for the answer to this, but to no avail. I thought I would turn to the forums. Thank you, Allasso Quote Link to comment Share on other sites More sharing options...
Caesar Posted January 26, 2009 Share Posted January 26, 2009 You can't do it all on the same page. Not using that approach, no. Why not just create a downloadable zip/archive of the files they want and have it as a single download? Quote Link to comment Share on other sites More sharing options...
allasso Posted January 27, 2009 Author Share Posted January 27, 2009 thank you, Caesar, Yes, I have heard that approach. This is for a website that is used for internal business in our community, and I am trying to make it as foolproof and streamlined as possible. Quote Link to comment Share on other sites More sharing options...
newbeee Posted January 27, 2009 Share Posted January 27, 2009 Hello, Just thought i'd add my thoughts on this. If the page is created on the fly and the files are not always the same then have the page create the zip of the chosen files. and then this zip could be stored in a temporary folder within your web folder i.e public_html. then the link to this file shown on the page. ok now for the part that removes this temporary zip file. have a cron job that runs another file that would check the date the file was created and delete all the files within this temporary folder that stores the zuip files apart from the files that have been created within the last hour and have this cron job run say every so many hours or how ever long you want to prevent your webspace from being eatten up by these temporary zip files. if you need any help with setting this up get back to me via a PM Jason Quote Link to comment 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.