[SOLVED] Downloading Files with PHP header()
Posted: Mon Mar 07, 2005 11:19 am
I'm having difficulty downloading files on my server. For some reason, when attempting to DL files other than text files, the file gets corrupted.
Adobe reports the file being corrupted or something, Microsoft word and excel reference a missing file, with is my .css file and the the doc is unreadable.
Here is my code for the header download of the file:
Anyone else have this problem, or know how to fix it?
Thanks!
Adobe reports the file being corrupted or something, Microsoft word and excel reference a missing file, with is my .css file and the the doc is unreadable.
Here is my code for the header download of the file:
Code: Select all
$theFile = "$path" . "$name"; # combine the path and file
header("Cache-Control: ");# leave blank to avoid IE errors
header("Pragma: ");# leave blank to avoid IE errors
header("Content-type: $type");
header("Content-Disposition: attachment; filename="".$name.""");
header("Content-length: $size");
readfile($theFile);Anyone else have this problem, or know how to fix it?
Thanks!