Thursday, March 31, 2011

PHP headers forced download and then redirect

Right now I have a php form that forces a download of a zip.

How can I redirect to another page and also force that download (where the download is actually php zip)?

Would I use javascript?

any ideas?

Thanks!

From stackoverflow
  • You could do something like this in your download redirect:

    Header("Location: downloadscript.php?filename");
    

    Good luck!

  • You can't do both on the same page : force download the file (using the Content-disposition header) and redirect the user.

    One thing you could is use JavaScript to open a new window to the download age when clicking on a link, and then redirect the user to an other page after a few seconds.

0 comments:

Post a Comment