anolan13 Posted August 15, 2007 Share Posted August 15, 2007 Hello, Once again I need some help with more advanced check boxes. Right now I have it so that files are displayed from a folder and next to them there is a check box, and at the bottom a delete button. If you check the boxes it deletes the selected file. Now what if I need a second button that when checked and clicked downloads the selected file to the users computer? This possible with PHP? I don't know if it is because of security issues maybe? Any help please? Thanks Link to comment https://forums.phpfreaks.com/topic/65148-download-all-checked-files-dynamically/ Share on other sites More sharing options...
trq Posted August 15, 2007 Share Posted August 15, 2007 Take a look in the FAQ/Code snippet repository forum. There is a thread in there, force download that should get you started. Link to comment https://forums.phpfreaks.com/topic/65148-download-all-checked-files-dynamically/#findComment-325218 Share on other sites More sharing options...
MadTechie Posted August 15, 2007 Share Posted August 15, 2007 would be better to create a zip with the selected files and download that, well thats what i did.. heres my old forceDownload funtion <?php function forceDownload($archiveName) { $headerInfo = ''; if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } // Security checks if( $archiveName == "" ) { echo "<html><title>Download </title><body><BR><B>ERROR:</B> The download file was NOT SPECIFIED.</body></html>"; exit; } elseif ( ! file_exists( $archiveName ) ) { echo "<html><title>Download </title><body><BR><B>ERROR:</B> File not found.</body></html>"; exit; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application/zip"); //<--- NOTICE I USED ZIP header("Content-Disposition: attachment; filename=".basename($archiveName).";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($archiveName)); readfile("$archiveName"); exit(); } ?> Link to comment https://forums.phpfreaks.com/topic/65148-download-all-checked-files-dynamically/#findComment-325224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.