Hi All,
I have a script for allowing web users to download files from my web site. It worked great with PHP version 5.0.4.. I had some problems with that version so upgraded to 5.2.3 - Some things seemed improved. However, now when I use this script I can't download large files. PHP just sits there and spins its wheels... Is there a setting somewhere that I need to adjust? I'm using PHP 5.2.3, IIS6, Win2003 Server. Here's my code:
$mm_type="application/octet-stream"; // Set mime type
$url="../pics/dc.jpg"; // Set directory path
if(file_exists($url)){
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($url)) );
header('Content-Disposition: attachment;
filename="'.basename($url).'"');
header("Content-Transfer-Encoding: binary\n");
$fp = fopen($url, 'rb'); // Open file
$buffer = fread($fp, filesize($url)); // Buffer
fclose ($fp); // Close file
print $buffer; // Print the buffer
}
if(!file_exists($url)){
echo "Incorrect file name or file did not exist!";
}
I have a script for allowing web users to download files from my web site. It worked great with PHP version 5.0.4.. I had some problems with that version so upgraded to 5.2.3 - Some things seemed improved. However, now when I use this script I can't download large files. PHP just sits there and spins its wheels... Is there a setting somewhere that I need to adjust? I'm using PHP 5.2.3, IIS6, Win2003 Server. Here's my code:
$mm_type="application/octet-stream"; // Set mime type
$url="../pics/dc.jpg"; // Set directory path
if(file_exists($url)){
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($url)) );
header('Content-Disposition: attachment;
filename="'.basename($url).'"');
header("Content-Transfer-Encoding: binary\n");
$fp = fopen($url, 'rb'); // Open file
$buffer = fread($fp, filesize($url)); // Buffer
fclose ($fp); // Close file
print $buffer; // Print the buffer
}
if(!file_exists($url)){
echo "Incorrect file name or file did not exist!";
}