note 88673 added to function.popen

From: Date: Tue, 03 Feb 2009 11:43:20 +0000
Subject: note 88673 added to function.popen
Groups: php.notes 
Request: Send a blank email to php-notes+get-150141@lists.php.net to get a copy of this message
If you want to download files from a linux server with a filesize bigger than 2GB you can use the following: <? function serveFile( $file , $as ){ header( 'Expires: Mon, 1 Apr 1974 05:00:00 GMT' ); header( 'Pragma: no-cache' ); header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header( 'Content-Description: File Download' ); header( 'Content-Type: application/octet-stream' ); header( 'Content-Length: '.trim(stat -c%s "$file") ); header( 'Content-Disposition: attachment; filename="'. $as .'"' ); header( 'Content-Transfer-Encoding: binary' ); //@readfile( $file ); flush(); $fp = popen("tail -c ".trim(stat -c%s "$file")." ".$file.' 2>&1', "r"); while(!feof($fp)) { // send the current file part to the browser print fread($fp, 1024); // flush the content to the browser flush(); } fclose($fp); } ?> ---- Server IP: 195.207.10.20 Probable Submitter: 212.71.13.72 ---- Manual Page -- http://www.php.net/manual/en/function.popen.php Edit -- https://master.php.net/note/edit/88673 Del: integrated -- https://master.php.net/note/delete/88673/integrated Del: useless -- https://master.php.net/note/delete/88673/useless Del: bad code -- https://master.php.net/note/delete/88673/bad+code Del: spam -- https://master.php.net/note/delete/88673/spam Del: non-english -- https://master.php.net/note/delete/88673/non-english Del: in docs -- https://master.php.net/note/delete/88673/in+docs Del: other reasons-- https://master.php.net/note/delete/88673 Reject -- https://master.php.net/note/reject/88673 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150141) next »