note 40607 added to function.fopen

From: Date: Tue, 09 Mar 2004 13:48:04 +0000
Subject: note 40607 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-66488@lists.php.net to get a copy of this message
This is a small script i made to go beyond the 2Gb download limit. It will also give the filesize using a normal ls command Hope this helps Matthijs <? /* Download script to go beyond 2Gb download limits */ /* This is for ZIP files only... */ /* march 2004 - M. Tempels */ set_time_limit(0); stream($_GET["filename"]); function stream($filename) { if (preg_match("/^[0-9a-zA-Z\.]{0,16}$/", $filename)) { $filetype = "application/zip"; $temp = exec("ls -la $filename"); $a = preg_split("/\s+/", $temp); $filesize = $a[4]; header("Content-Type: $filetype"); header("Content-length: $filesize"); header("Content-Disposition: filename=$filename"); $fp = popen("cat $filename", 'r'); if ($fp) { while(!feof($fp)) { print(fread($fp, 1024*8)); flush(); } pclose($fp); } } else { die ("[*] Invalid Filename Specified"); } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40607 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40607&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40607&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66488) next »