mccoy81 Posted May 14, 2012 Share Posted May 14, 2012 Hello, I am trying to get a download box to pop-up and ask to save as for a zip file in the same window. The file being downloaded is based on user input of a download code that was sent to them in their email. I have everything working as far as validating their input but how do I force the download box to pop up after their input has been looked at and the correct file has been chosen? I have tried using header but that will only work if I redirect them to another page. I would like the box to pop up like I have seen on other site where a file is downloaded. Is this something I can do in php or do I need to use javascript? Also can anyone lead me in the right direction as to the code I would need to accomplish this? Thanks for your help ahead of time. Link to comment Share on other sites More sharing options...
Larry Posted May 14, 2012 Share Posted May 14, 2012 You can't do this in JavaScript and can do it in PHP. It is a matter of sending the right headers. See the book's example for showing images via a proxy script. Then you'll take that same basic principle and send a ZIP file instead of an image (with some edits). The browser will automatically create the pop-up, depending upon the browser and its settings. Link to comment Share on other sites More sharing options...
Recommended Posts