Initiating file download after form submit

T

Tim Fooy

Hi all,

I'm having this (i think) simple problem. On my page the user can submit a
form, which calls back to the same page (it's actually PHP, but that doesn't
matter i think). The PHP records the submitted data into a archive-file.
And after that, the user should get a download dialog, asking where he would
like to save a file (not the archive-file). How can i initiate such a
download dialog without the user having to manually click on a direct link
to the file?

TIA,

regs,

Tim
 
T

Toby Inkster

Tim said:
I'm having this (i think) simple problem. On my page the user can submit a
form, which calls back to the same page (it's actually PHP, but that doesn't
matter i think). The PHP records the submitted data into a archive-file.
And after that, the user should get a download dialog, asking where he would
like to save a file (not the archive-file).

Your form handler should, instead of returning a "Thank You" page, send an
application/zip Content-Type header and then the zipped data.
 
H

Hywel

Hi all,

I'm having this (i think) simple problem. On my page the user can submit a
form, which calls back to the same page (it's actually PHP, but that doesn't
matter i think). The PHP records the submitted data into a archive-file.
And after that, the user should get a download dialog, asking where he would
like to save a file (not the archive-file). How can i initiate such a
download dialog without the user having to manually click on a direct link
to the file?

Read up on PHP's "header()" function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top