I am using php-4.1.2 and apache-1.3.26. I am allowing users to download
files from my site. The problem is that the file is not downloded fully.
After downloading say 84%, the counter stops and download manager says that
the download is complete. This problem is intermittent. Sometimes the file
is downloaded fully and sometimes not. Here is the code I am using.... 
----------------------------------------------------------------------------
--------
$range=getenv(http_range);
$fsize = filesize($DOWNLOAD_FILE_DIRECTORY . $file_name);
$p1 = strpos($range, "bytes=");
$p2 = strpos($range, "-");
$offset = substr($range, $p1+6, $p2-1);
header( "Content-type: " . $file_type ); 
$header_range = sprintf("Content-Range: bytes %ld-%ld", $offset, $fsize );
header($header_range);
$header_range = sprintf("Content-length: %ld", $fsize - $offset );
header($header_range);
header("Content-disposition-type: attachment\r\n"); 
header("Content-disposition: filename=" . $file_name); 
header( "Content-Description: PHP3 Generated Data" );
header( "Accept-Ranges: bytes" );
$fp = fopen($DOWNLOAD_FILE_DIRECTORY . $file_name, "r");
fseek($fp, $offset);
do
{
$section = fread($fp, 102400);
echo $section;
} while (!feof($fp));
fclose($fp);

----------------------------------------------------------------------------
---
What could be the problem?
Now, I have changed my code to this
----------------------------------------------------------------------------
----
$fsize = filesize($DOWNLOAD_FILE_DIRECTORY . $file_name);
header("Content-Disposition: attachment; filename = " . $file_name);
header("Content-Type: application/x-zip");
header("Content-Length: " . $fsize);
$fp = fopen($DOWNLOAD_FILE_DIRECTORY . $file_name, "r")
fpassthru($fp);
flcose($fp);
----------------------------------------------------------------------------
----
It works with IE 6.0 only. IE 5.5 and 5.0 are still not working. With 5.5
and 5.0 empty files are saved.
I don't what I am doing wrong. If anyone have any idea can you please let me
know.
Thanks for any kind of help.


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

Reply via email to