Fix downloads due to chunkSize not being defined

pull/3621/head
Isaac Connor 2022-10-11 16:43:38 -04:00
parent 87627cac8e
commit d64868a44b
1 changed files with 6 additions and 7 deletions

View File

@ -2366,7 +2366,7 @@ function extract_auth_values_from_url($url) {
return array( $username, $password );
}
function output_file($path) {
function output_file($path, $chunkSize=1024) {
if (connection_status() != 0)
return false;
$parts = pathinfo($path);
@ -2378,12 +2378,11 @@ function output_file($path) {
header("Content-Transfer-Encoding: binary");
header("Content-Type: $contentType");
$contentDisposition = 'attachment'; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$fileName = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);
header("Content-Disposition: $contentDisposition;filename=\"$file\"");
} else {
header("Content-Disposition: $contentDisposition;filename=\"$file\"");
$contentDisposition = 'inline';
if (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
$file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);
}
header("Content-Disposition: $contentDisposition;filename=\"$file\"");
header('Accept-Ranges: bytes');
$range = 0;
@ -2400,7 +2399,7 @@ function output_file($path) {
} else {
$size2 = $size - 1;
header("Content-Range: bytes 0-$size2/$size");
header("Content-Length: " . $size);
header('Content-Length: ' . $size);
}
if ($size == 0) {