PHP can download exe files like download rar First fread in the output of the download, do not access the EXE file in the site's path to download, can you achieve this effect?
Reply to discussion (solution)
With the same request
Not as far as I know.
Here you can add the code you want to add, such as:
/*
if (! ( $_server[' Http_referer ' && strpos ($_server[' http_referer '], ' http://'. $_server[' http_host ']) = = = 0)) {
Die (' prohibit off-station operation! ');
}
*/
Header (' Content-type:application/octet-stream '); EXE file in MIME format
Header (' content-disposition:attachment; Filename=yournewfilename.exe '); You want to download as a new file name
echo file_get_contents (' Yourfile.exe '); Fetch the file source, of course, here can also use fopen, fread read the file
?>
Gets the path of the file, compressed and then downloaded.
The key is that the header is set correctly, otherwise the file data may be displayed directly in the browser.
The principle is feasible, depends on the service side configuration situation.
Of course. You can also use the ReadFile () method to read the file
Of course. You can also use the ReadFile () method to read the file
I try to use frend read after setting hearder output is can download exe, but I source is 90m exe file, download down really only 180b files, ...
Gets the path of the file, compressed and then downloaded.
Every time I use PHP to read EXE file after setting the header information output download download down the old only 180b files, under the guidance of the Guide, why AH?
The key is that the header is set correctly, otherwise the file data may be displayed directly in the browser.
Set, as if PHP can not read EXE file AH
PHP Script settings
Set_time_limit (0);
Give it a try? Is the file too large and timed out?