hi,

AFAIK this is not something that you need to bother with in your php scripts. this is a web server level issue



Scott Dotson wrote:

I am trying to get the ability to resume broken downloads with a client
(such as FlashGet, GetRight, etc...)  I am able to download the complete
file without resume and everything works properly, but, when using a
download manager, if I break the download then continue, the byte count
never matches up.  I am checking for the $_ENV['HTTP_RANGE'] and setting up
my headers based on this info.  But, the byte count continues to be
incorrect.  Could someone point me in the right direction?  Thanks in
advance for any assistance.  Below you will find my code....

<?php
session_cache_limiter('public');
session_start();
set_time_limit(0);
$file=$_REQUEST['file'];
$extstart=strpos($file, ".");
$ext=substr($file, $extstart+1);
$dir="d:\\downloadable_courses";
$size=filesize($dir."\\".$file);
header("Accept-Ranges: bytes");
if(isset($_ENV['HTTP_RANGE'])) {
list($a, $range)=explode("=",$_ENV['HTTP_RANGE']);
str_replace($range, "-", $range);
$size2=$size-1;
header("Content-Range: $range$size2/$size");
$new_length=$size2-$range;
header("Content-Length: $new_length");
} else {
$size2=$size-1;
header("Content-Range: bytes 0-$size2/$size");
header("Content-Length: ".$size2);
}
header("Content-Type: application/".$ext);
header("Content-Disposition: inline; filename=$file");
$fp=fopen($dir."\\".$file, "rb");
fpassthru($fp);
exit;
?>





--
http://www.radinks.com/upload
Drag and Drop File Uploader.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to