Hi,
I have a link in my page that allows users to download an exe file.
However, when I download and run it, it briefly displays the DOS box and
nothing happens.
In my php file, I have:
header("Content-Type: application/octet-stream");
header("Content-Disposition: atachment; filename=$filename");
header("Content-Length: ".filesize("$path/$filename"));
header("Pragma: no-cache");
header("Expires: 0");
$fp=fopen("$path/$filename","r");
print fread($fp,filesize("$path/$filename"));
fclose($fp);
exit();
I tried to zip the file and use content-type as application/x-zip.
Again, it downloads as a zip file but when I try to open it, I get the
following error message:
WinZip
Cannot open file: it does not appear to be valid archive.
If you downloaded this file, try downloading it again.
Am I missing something?
Also, if I click on the download again, after downloading it already, it
displays garbled text on the screen.
Thanks a lot for your help.