saco721 Posted September 30, 2008 Share Posted September 30, 2008 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</a> </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. Any help would be grately appreciated! - Thank you Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/ Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 I think you need to name your iframe and then reference that name in your a tag. Also, please put your code in the code tags, as it makes it easier to follow. Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653809 Share on other sites More sharing options...
saco721 Posted September 30, 2008 Author Share Posted September 30, 2008 OK, have given iframe a name, where do I go next? Sorry about the code, as I am unsure as to how to put my code in code tags. Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653840 Share on other sites More sharing options...
saco721 Posted September 30, 2008 Author Share Posted September 30, 2008 I was wondering if this is more of a javascript problem as so far all the solutions I have tried using are javascript. Should I try a javascript forum? if so could you suggest a good one. Thank you for your time. Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653842 Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 To put your code in code tags, click the button that has a # on it. OK, I'll pretend your frame name is "famename" <a target="framename" href="filedownload.php?filename=filetodownload.txt">Download this text file</a> Try that. As far as JS, there's a JS board on this site. Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653844 Share on other sites More sharing options...
saco721 Posted September 30, 2008 Author Share Posted September 30, 2008 OK, I have tried what you suggested, but it still doesnt work, I get the saveas dialog, after that runs, the window goes blank. Could you please try this and tell me if you get the same result. Thank you for your time. Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653869 Share on other sites More sharing options...
F1Fan Posted September 30, 2008 Share Posted September 30, 2008 Sorry, if that didn't work, then I'm not sure what would. I wonder if it has something to do with the PHP header tags? Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653883 Share on other sites More sharing options...
saco721 Posted September 30, 2008 Author Share Posted September 30, 2008 Hi, I have tried using : header('Location: http://www.testdl.com'); in my filedownload.php file, it reloads fine but wont display saveas dialog. Any suggestions? thanks Link to comment https://forums.phpfreaks.com/topic/126447-redirect-page-in-iframe-after-calling-saveas-dialog/#findComment-653891 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.