if (!($size = @filesize($path_file))) { $size = $d_size; } $name = empty($rn) ? $n : $rn; if (is_browser('mozilla')) { $h_name = "filename*=UTF-8''" . rawurlencode(htmlspecialchars_decode($name)); } else { if (is_browser('opera, safari, konqueror')) { $h_name = 'filename="' . str_replace('"', '', htmlspecialchars_decode($name)) . '"'; } else { $h_name = 'filename="' . rawurlencode(htmlspecialchars_decode($name)) . '"'; } } //Figure out the MIME type (if not specified) $ext = array_pop(explode('.', $path_file)); $mime_type = get_mime_for_header($ext); if (@ob_get_length()) { @ob_end_clean(); } // required for IE, otherwise Content-Disposition may be ignored if (@ini_get('zlib.output_compression')) { @ini_set('zlib.output_compression', 'Off'); } header('Date: ' . gmdate('D, d M Y H:i:s', $ftime) . ' GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $ftime) . ' GMT'); header('Content-Encoding: none'); header('Content-Disposition: ' . ($is_image || $is_live ? 'inline' : 'attachment') . '; ' . $h_name); #if($is_image) #{ # header('Content-Transfer-Encoding: binary'); #}
$size = $d_size; } $name = empty($rn) ? $n : $rn; #encode the file name correctly if (is_browser('mozilla')) { $h_name = "filename*=UTF-8''" . rawurlencode(htmlspecialchars_decode($name)); } else { if (is_browser('opera, safari, konqueror')) { $h_name = 'filename="' . str_replace('"', '', htmlspecialchars_decode($name)) . '"'; } else { $h_name = 'filename="' . rawurlencode(htmlspecialchars_decode($name)) . '"'; } } #Figure out the MIME type (if not specified) $ext = array_pop(explode('.', $path_file)); $mime_type = get_mime_for_header($path_file); #disable execution time limit @set_time_limit(0); #disable output buffering @ob_end_clean(); #close the db connection, and session garbage_collection(); #required for IE, otherwise Content-Disposition may be ignored if (@ini_get('zlib.output_compression')) { @ini_set('zlib.output_compression', 'Off'); } #open the file if (!($fp = @fopen($path_file, 'r'))) { #it's failed to open ! header("HTTP/1.0 404 Not Found"); @fclose($pfile);