|
|
|
เมื่ออัพไฟล์ขึ้น Host จำลองแล้ว ทำไงคลิกที่ลิงค์แล้วจะดาว์โหลดได้ครับ |
|
|
|
|
|
|
|
หน้า link
<a href="download.php?filename=<?=$filename?>"><?=$filename?></a>
หน้า download
$path = "c:/AppServ/www/information/download/";
$fname = $_REQUEST["filename"];
$fullpath = "$path$fname";
if (!file_exists($fullpath))
{
die("<br>File not found");
}
preparedownloadheader("$fname");
readfile($fullpath);
function preparedownloadheader($filename, $contenttype = "", $forcedownload = true)
{
if ($contenttype == "")
{
$contenttype = "application/octet-stream";
}
if (connection_status() != 0) return false; // check connection
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-Type: $contenttype");
$disposition = $forcedownload ? "attachment" : "inline";
header("Content-Disposition: $disposition; filename=\"" . $filename) . "\"";
header("Content-Transfer-Encoding: binary");
}
|
|
|
|
|
Date :
2010-02-23 11:36:01 |
By :
windersun |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|