CanMan2004 Posted October 1, 2006 Share Posted October 1, 2006 Hi allI have the following script which forces a file download[code] $dir="../../documents/"; $getfile=$dir.$filename; header("Content-type: application/force-download"); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($getfile)); header("Content-disposition: attachment; filename=\"".basename($getfile)."\""); readfile("$getfile");[/code]The problem is that if I run this, there is no way to perform a close window script or a page redirection script when the file download box has poped up, the reason I ask is that when you excuite the above code, you areu are left with a blank page.Does that make sense?Thanks in advanceEd Link to comment https://forums.phpfreaks.com/topic/22687-force-download-issue/ Share on other sites More sharing options...
Destruction Posted October 2, 2006 Share Posted October 2, 2006 Normally this would be called as a link from another page using the standard <a href......... etc. If you're doing this, you should be able to use target="_self" as an attribute of the link. This will open the download file box in the same window without moving on or opening a new blank window. Let me know if this doesn't work and I'll double check but I'm fairly certain that's the way around it.Dest Link to comment https://forums.phpfreaks.com/topic/22687-force-download-issue/#findComment-102108 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.