Auto start file download after form submission

后端 未结 3 635
离开以前
离开以前 2020-12-09 05:46

I have a web form that users complete online. When they press submit it will start a file download for them.

At the moment, I process the form submission and generat

相关标签:
3条回答
  • 2020-12-09 05:59

    You can insert a hidden iframe into your page and submit your form to this iframe.

    0 讨论(0)
  • 2020-12-09 06:08

    You could send the form to the Thank you document and put there a META refresh to the file download:

    <meta http-equiv="refresh" content="3;url=download.php">
    <p>Thank you! The download will start in 3 seconds. If not, use this link to download the <a href="download.php">file</a></p>
    
    0 讨论(0)
  • 2020-12-09 06:08

    Add a second page that says something "thank you, your donwnload will start in a few seconds" and triggers the download using javascript:

    $(document).ready(function(){
      window.setTimeout(function(){
        window.location = 'http://yourdownloadhost.com/file.zip';
      }, 1500);
    });
    

    or use a meta redirect.

    0 讨论(0)
提交回复
热议问题