I have code which downloads a picture from a fake link. I have looked at others comments / sites but nothing has helped me find the solution to the annoying :
"Failed to load resource: Frame load interrupted"
my php headers are after I read the GET value:
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: private",false); // required for certain browsers
//header('Content-Length: '. @filesize($id));
header('Content-Type: '.$mim);
header('Content-Disposition: attachment; filename="'.$date.basename($fileName).'"');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
readfile($fileName);
and I have jQuery script which calls an iframe to download the file:
$('body').append('<iframe class="download" src="download.php?id='+downloading+'" style="visibility:hidden;" width="0" height="0"></iframe>');
I downloads the file correctly, but shows an error in the console, please let me know if its fixable??
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-type: application/x-unknown"); // I always use this
header("Content-Disposition: attachment; filename='theFilename.ext'");
header("Content-Transfer-Encoding: binary");
header("Content-Length: 177998"); // you might want to set this
readfile('/the/url/to/theFilename.ext');
This will work ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With