|
|
|
@ -285,8 +285,9 @@ class DocumentManager |
|
|
|
|
|
|
|
|
|
return 'application/octet-stream'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This function smart streams a file to the client using HTTP headers |
|
|
|
|
* This function smart streams a file to the client using HTTP headers. |
|
|
|
|
* |
|
|
|
|
* @param string $fullFilename The full path of the file to be sent |
|
|
|
|
* @param string $filename The name of the file as shown to the client |
|
|
|
@ -298,6 +299,7 @@ class DocumentManager |
|
|
|
|
{ |
|
|
|
|
if (!file_exists($fullFilename)) { |
|
|
|
|
header("HTTP/1.1 404 Not Found"); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -307,6 +309,7 @@ class DocumentManager |
|
|
|
|
$fm = @fopen($fullFilename, 'rb'); |
|
|
|
|
if (!$fm) { |
|
|
|
|
header("HTTP/1.1 505 Internal server error"); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -344,10 +347,11 @@ class DocumentManager |
|
|
|
|
fseek($fm, $begin, 0); |
|
|
|
|
|
|
|
|
|
while (!feof($fm) && $cur <= $end && (connection_status() == 0)) { |
|
|
|
|
print fread($fm, min(1024 * 16, ($end - $cur) + 1)); |
|
|
|
|
echo fread($fm, min(1024 * 16, ($end - $cur) + 1)); |
|
|
|
|
$cur += 1024 * 16; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This function streams a file to the client. |
|
|
|
|
* |
|
|
|
|