I wrote the upload and download function myself, but when I downloaded it, it said the file was damaged? The method is the same as what is written online.
The code is as follows:
$filename = $_GET['file']; header("Content-Disposition:attachment;filename=".$filename); header("Content-Length:".filesize($filename)); readfile($filename);
寻觅 beyond2017-10-13 20:50:22
Does your form for uploading files have the attribute enctype='multipart/form-data'?
Then, is the type of the form item for uploading files set to file?
Then, does the uploaded file obtain relevant information from $_FILES[ ][ ]?
Then, are you sure you can get the file using the get method? Are you sure you want to use get method?
Then, do you specify the file type (MIME type header information) before downloading the file?
What is written online may not be correct. Read the manual. The manual is authoritative