<?php
$file="lp2maray.png";
echo"<link href='mycss/gradient.css' rel='stylesheet' type='text/css' />";
echo "<span class=judul_head>» <b>File Download :</b></span>";
echo "<li><a href='downloadget.php?file=$file' title='$file'>$file</a> </li>";
?>
downloadget.php
<?php
$direktori = "ypathfile/";
$namafile=$_GET["file"];
if (!file_exists($direktori.$namafile)) {
echo "<h1>Access forbidden!</h1>
<p>Maaf, file $namafile yang Anda download sudah tidak tersedia atau filenya (direktorinya) telah diproteksi. <br />
Silahkan hubungi <a href='mailto:adiarray@gmail.com'>Administrator MAIL</a>.</p>";
exit();
}
else {
header("Content-Type: octet/stream");
header("Content-Disposition: attachment; filename=\"".$namafile."\"");
$fp = fopen($direktori.$namafile, "r");
$data = fread($fp, filesize($direktori.$namafile));
fclose($fp);
print $data;
}
?>
Tidak ada komentar:
Posting Komentar