Stacy
Stacy

Reputation:

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?

Would I use JavaScript?

Upvotes: 2

Views: 3756

Answers (2)

Wookai
Wookai

Reputation: 21733

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.

Upvotes: 3

Ian P
Ian P

Reputation: 12993

You could do something like this in your download redirect:

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

Good luck!

Upvotes: 0

Related Questions