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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -