Can php download exe files? can php download exe files, do not download exe files from the website. can this effect be achieved? Php ------ solution --------------- can php download exe files?
Can php download exe files? like downloading rar files, fread downloads files first in the output. do not access the exe file to download files in the website path. can this effect be achieved?
Php
------ Solution --------------------
Same request, reserved name
I do not know.
------ Solution --------------------
// The code you want to add can be added here, for example:
/*
If (! ($ _ SERVER ['http _ referer'] & strpos ($ _ SERVER ['http _ referer'], 'http ://'. $ _ SERVER ['http _ host']) === 0 )){
Die ('prohibit operations outside the site! ');
}
*/
Header ('content-type: application/octet-stream'); // mime format of the exe file
Header ('content-Disposition: attachment; filename=yournewfilename.exe '); // you want to download the new file name
Echo file_get_contents('yourfile.exe '); // Obtain the file Source. of course, you can use fopen or fread to read the file.
?>
------ Solution --------------------
Obtain the file path, compress the file, and download it.
------ Solution --------------------
The key is that the header is correctly set; otherwise, the file data may be displayed directly in the browser.
------ Solution --------------------
In principle, it depends on the configuration of the server.
------ Solution --------------------
Of course. You can also use readfile () to read files.
------ Solution --------------------
Php script settings
Set_time_limit (0 );
Try? Is the file too large and times out?