我有以下文件:
下载.php
<?php
$filename = $_GET["filename"];
if ($filename) {
$path = "/svg_files/".$filnavn."";
header('Content-Transfer-Encoding: binary'); // For Gecko browsers mainly
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($path)) . ' GMT');
header('Accept-Ranges: bytes'); // For download resume
header('Content-Length: ' . filesize($path)); // File size
header('Content-Encoding: none');
header('Content-Type: application/svg'); // Change this mime type if the file is not PDF
header('Content-Disposition: attachment; filename=' . $filename); // Make the browser display the Save As dialog
}
?>
它位于 svg_files 文件夹中。但是当我运行时:
myweb.com/svg_files/download.php?filename=file.svg
我只是得到一个空文件。