Jump to content

redirecting page in iframe after calling saveas dialog


saco721

Recommended Posts

Hi!,

 

I was wondering if it is possible to reload / redirect a page in an iframe after a saveas dialog has been called. It seems like quite a simple concept but I have tried various methods to get this to work without success. All I seem to get is the page reload / redirect or the saveas dialog, never both.

 

here is the code:

 

mainpage.html

 

<html>
<body>
<iframe src="filedownload.html"
width="40%" height="80"
align="right" border = "1">
</iframe>
</body>
</html>

filedownload.html:

 

<html>
<head>
</head>
<body>
<a href="filedownload.php?filename=filetodownload.txt">Download this text file[/url]
</body>
</html>

 

filedownload.php:

 

<?PHP

header("Content-type: application/octet-stream");
header("Content-Length: ".filesize($filename));
header("Content-Disposition: attachment; filename=$filename");


$fp = fopen($filename, 'rb');
fpassthru($fp);
fclose($fp);
?>

 

If it is possible, what code should I use to accomplish this is, and what file the code should go in. I am new to php and js so please be patient.

 

Any help would be grately appreciated! - Thank you

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.