-1
我想共享放置在我的服務器的第二個HDD上的文件。這時我用/改編下面的腳本:從我的服務器的第二個HDD下載文件
$file_path = $DLPath."/$file";//$_REQUEST['file'];
header("Pragma: public");
header("Expires: -1");
header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0");
header("Content-Disposition: attachment; filename=\"$file_name\"");
// set appropriate headers for attachment or streamed file
if ($is_attachment)
header("Content-Disposition: attachment; filename=\"$file_name\"");
else
header('Content-Disposition: inline;');
// set the mime type based on extension, add yours if needed.
$ctype_default = "application/octet-stream";
$content_types = array(
"exe" => "application/octet-stream",
"zip" => "application/zip",
"mp3" => "audio/mpeg",
"mpg" => "video/mpeg",
"avi" => "video/x-msvideo",
);
$ctype = isset($content_types[$file_ext]) ? $content_types[$file_ext] : $ctype_default;
header("Content-Type: " . $ctype);
$DLPath
是絕對路徑(到/ mnt/disk100)。
我認爲在「標題」調用中發生錯誤。但我不知道我該如何處理這件事。
'MNT/disk100'不絕對。 '/ mnt/disk100'爲 –
對不起,這是一個複製/粘貼錯誤... – PM84
是'$ file_name'定義的?另外,錯誤日誌中是否有相關的信息? –