compression - Compressed files using php won't work in windows -
i trying compress video files on fly using php , forcing compressed file download. below code have written.
$files_todownload_string = ' movie1.mov movie2.mov ' header('content-type: application/x-gzip'); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename="file.zip"'); header( 'content-transfer-encoding: binary' ); $fp = popen('zip -v - ' . $files_todownload_string, 'r'); $bufsize = 8192; $buff = ''; while( !feof($fp) ) { $buff = fread($fp, $bufsize); echo $buff; print " "; } pclose($fp);
the compression done , zip file downloaded successfully. however, when trying open zip file in windows os, won't open. says compressed file corrupted.
any helps guys? in advance.
remove print " ";
you're adding bytes.
Comments
Post a Comment