hijinio wrote:Hey guys,
I've got a page that sends a file through the header for a download. Downloading files this way works fine in a conventional browser (e.g. Firefox), but I get a download error on my mobile phone using Opera Mini/ Mobile. (The error is very vague as it just says it had a problem downloading.) However, again via my mobile on other sites, I can download files sent through headers with no problems (e.g. Yahoo! mail attachments.)
Anybody have experience with this or have any ideas what's going on?
Here are the headers I'm using:
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Content-Description: File Download");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"" . $elFile . "\"");
header("Content-length:" . (string)(sprintf("%u", filesize($elFilePath))));
header("Content-Transfer-Encoding: binary\n");
Thanks!
Hiji
I think you have to many ""
try this
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Content-Description: File Download");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\" . $elFile);
header("Content-length:" . (string)(sprintf("%u", filesize($elFilePath))));
header("Content-Transfer-Encoding: binary\n");
or
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
header("Content-Description: File Download");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\" . $elFile . " ");
header("Content-length:" . (string)(sprintf("%u", filesize($elFilePath))));
header("Content-Transfer-Encoding: binary\n");
the first should work tho.