substituted _ for , in composing a file name for Contentent-Disposition in codepot_readfile

This commit is contained in:
hyung-hwan 2017-11-30 03:38:43 +00:00
parent c6808d6530
commit 731ea00d18

View File

@ -531,13 +531,18 @@ if ( ! function_exists('codepot_readfile'))
$size = filesize($location); $size = filesize($location);
$time = date('r',filemtime($location)); $time = date('r',filemtime($location));
// some browser don't like a comma in Content-Disposition
$fn = $filename;
$fn = str_replace (',', '_', $fn);
$fn = str_replace (';', '_', $fn);
if ($size <= 0) if ($size <= 0)
{ {
header("Content-Type: $mimeType"); header("Content-Type: $mimeType");
header('Cache-Control: public, must-revalidate, max-age=0'); header('Cache-Control: public, must-revalidate, max-age=0');
header('Pragma: no-cache'); header('Pragma: no-cache');
header("Content-Length: $size"); header("Content-Length: $size");
header("Content-Disposition: $disposition; filename=$filename"); header("Content-Disposition: $disposition; filename=$fn");
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
header('Connection: close'); header('Connection: close');
header("Last-Modified: $time"); header("Last-Modified: $time");
@ -582,7 +587,7 @@ if ( ! function_exists('codepot_readfile'))
header('Accept-Ranges: bytes'); header('Accept-Ranges: bytes');
header('Content-Length:' . ($end - $begin)); header('Content-Length:' . ($end - $begin));
header("Content-Range: bytes $begin-" . ($end - 1) . "/$size"); header("Content-Range: bytes $begin-" . ($end - 1) . "/$size");
header("Content-Disposition: $disposition; filename=$filename"); header("Content-Disposition: $disposition; filename=$fn");
header("Content-Transfer-Encoding: binary"); header("Content-Transfer-Encoding: binary");
header("Last-Modified: $time"); header("Last-Modified: $time");
header('Connection: close'); header('Connection: close');