note 40607 deleted from function.fopen by nlopess
| From: | nlopess@php.net | Date: | Tue, 09 Mar 2004 14:52:57 +0000 |
| Subject: | note 40607 deleted from function.fopen by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66492@lists.php.net to get a copy of this message | ||
Note Submitter: mtempels@townsville.nl
----
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");
}
}
?>