Hi,
I'm trying to let users download a file via php and it's corrupt once one saves it on their machine. Notice that the file is not local.
Here's the code snippet:
$fileName = 'http://example.com/file.zip';
$fileSize = 3256;
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$fileName");
header("Content-Length: " . $fileSize);
readfile($fileName);
So, the "save as" dialog opens fine and I can save the file. It gets downloaded, correct size and all, but I cannot open it. Any ideas?
If it helps, I'm running Apache2.0.52/php4.3.9 under Fedora. Thanks in advance.
Edit: forgot the mention that the fopen wrappers have been enabled, so that's not the issue.