Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load resource: Frame load interrupted - Agian

Tags:

jquery

php

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??

like image 660
Jason Avatar asked Sep 10 '12 21:09

Jason


1 Answers

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 ;-)

like image 113
conal_lab24 Avatar answered Sep 19 '22 06:09

conal_lab24