<?php
// downloading a file
$filename = $_GET['C:\AppServ\www\WebCom\files']; ###ผมแก้ที่เก็บไฟล์###
// fix for IE catching or PHP bug issue
header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// browser must download file from server instead of cache
// force download dialog
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
// use the Content-Disposition header to supply a recommended filename and
// force the browser to display the save dialog.
header("Content-Disposition: attachment; filename=".basename($filename).";");
/*
21.The Content-transfer-encoding header should be binary, since the file will be read
22.directly from the disk and the raw bytes passed to the downloading computer.
23.The Content-length header is useful to set for downloads. The browser will be able to
24.show a progress meter as a file downloads. The content-lenght can be determines by
25.filesize function returns the size of a file.
26.*/
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
@readfile($filename);
exit(0);
?>
Code
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 15
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 16
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 21
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 22
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 28
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 38
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\WebCom\download.php:8) in C:\AppServ\www\WebCom\download.php on line 39