can php download exe files at a time?

Source: Internet
Author: User
Tags php download
can php download exe files?
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? PHP


------Solution--------------------
With the same request
Not as far as I know.
------Solution--------------------

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

?>
------Solution--------------------
Gets the path of the file, compressed and then downloaded.
------Solution--------------------
The key is that the header is set correctly, otherwise the file data may be displayed directly in the browser.
------Solution--------------------
The principle is feasible, depends on the service side configuration situation.
------Solution--------------------
Of course. You can also use the ReadFile () method to read the file
------Solution--------------------
PHP Script settings
Set_time_limit (0);
Give it a try? Is the file too large and timed out?
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.