You're going to laugh at me. "Download file" So simple is worth saying? Of course it's not as simple as you think. For example, you want customers to fill out a form, you can download a file, your first thought must be "Redirect" method, first check whether the form has been completed and complete, and then the URL refers to the file, so that customers can download, such as the author of the following code:
Check if the form is complete ...
if ($form _completed) {
Header ("Location:http://www.etoow.com/download/info_check.exe");
Exit
}
?>
Or in the following cases:
"Start download File"
The ID is used here to receive the number of the file to download, and then "Redirect" the way to connect to the actual URL.
If you want to do an e-commerce website on "online shopping", considering security issues, you do not want users to directly copy the URL to download the file, I suggest you use PHP directly read the actual file and then download the method to do. The procedure is as follows:
$file _name = "Info_check.exe";
$file _dir = "/public/www/download/";
if (!file_exists ($file _dir. $file _name)) {//check if file exists
echo "File not found";
Exit
} else {
$file = fopen ($file _dir. $file _name, "R"); Open File
Input File Label
Header ("Content-type:application/octet-stream");
Header ("Accept-ranges:bytes");
http://www.bkjia.com/PHPjc/630407.html www.bkjia.com true http://www.bkjia.com/PHPjc/630407.html techarticle you're going to laugh at me. Downloading a file is so simple and worth saying? Of course it's not as simple as you think. For example, you want the customer to fill out a form before they can download a file, your first ...