HTML PHP
What is the difference between HTML implementation file download and PHP implementation?
How to let the user can only download the file through the link on the webpage, can't find it through the address?
Reply to discussion (solution)
Database to store the path of the download, click Query Database, find the download address.
But this is not very safe, the download address will eventually be exposed
Web links to a PHP, this PHP based on the address to read the file, and then segmented output
The first parameter, you can make the path more complex $file = fopen ($file _dir. $file _name, "R"); Open the file//input file tag header for download ("Content-type:application/octet-stream"); Header ("Accept-ranges:bytes"); Header ("Accept-length:". FileSize ($file _dir. $file _name)); Header ("content-disposition:attachment; Filename= ". $file _name);//output file contents//Echo fread ($file, FileSize ($file _dir. $file _name));//Output Fread ($file, FileSize ($file _dir. $ file_name)); fclose ($file); exit ();
Very easy to find code