2012-10-25 118 views
0

我有以下文件:力 '另存为' SVG文件

的download.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

我只是得到一个空文件。

回答