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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.