I have a script that pushes a file out using content headers so that the browser will initiate a save as /open.
It works ok if I save to disk... it works ok for some of the filetypes (like word docs).
If you open an image (gif,jpeg,png) and say open it.. it gives me a "Can't read file header" UNKNOWN FILE FORMAT.
If i save the file it works fine... i just don't know if this is a error with how i'm doing it or something with the browser. IE6 and Firefox both do the same thing.
My code looks like:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=$virtualFile");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($virtuallFile));
@readfile($fullfilename);
which is basically straight from php.net.
Any thoughts or suggestions would be awesome.