Hi,
can you please tel me how to use this
header(content type: Application/Force Download) to do a downlod. asume the exe file name is abc.exe
Thanks.
| SitePoint Sponsor |
Hi,
can you please tel me how to use this
header(content type: Application/Force Download) to do a downlod. asume the exe file name is abc.exe
Thanks.


Some browsers don't like 'force download'. I'd use x-download or octet-stream.PHP Code:header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=abc.exe");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . @filesize('abc.exe'));
set_time_limit(0);
@readfile('abc.exe');
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.
Hai Dan,
Thanks a lot.
I have 2 small questions
set_time_limit(0);
@readfile('abc.exe');
1. Why a set time out has used here?
2. what is that '@' tell in php
1.) Because .exe's can be very large (readfile() will read the file, then output it.. which can easily surpass php's maximum execution time
2.) @ will suppress errors.
No problem.![]()
Bookmarks