dounieliang4712 2014-12-01 07:06
浏览 614

在表单提交上下载文件

On submitting the form it should download the file and page gets redirected ideally, this is what I am trying

Now I am using hubspot form My code looks like this which is just to submit the form and redirecting to new page on form submittion.

<form accept-charset="UTF-8" enctype="multipart/form-data" id="hsForm_84b04dc8-4a51-44cc-aa1d-036709bd681f" class="hs-form stacked" action="https://forms.hubspot.com/uploads/form/v2/462167/84b04dc8-4a51-44cc-aa1d-036709bd681f" method="POST">
    <h2>The Outsourcing Planning Template</h2>
    <div class="col-md-6">
       <input type="text" class="form-control" required="required" id="firstname-84b04dc8-4a51-44cc-aa1d-036709bd681f" name="firstname"  placeholder="Name">
    </div>
    <div class="col-md-6">
       <input  type="email" class="form-control" required="required" id="email-84b04dc8-4a51-44cc-aa1d-036709bd681f" name="email"  placeholder="Email Address">
    </div>
    <div class="hs_submit">
       <div class="actions"><input class="btn btn-default" type="submit"></div>
    </div>
</form>

Now to download the pdf file I modified the 3rd last line in the code as below:

<div class="hs_submit">
   <div class="actions"><input class="btn btn-default" href="http://cdn2.hubspot.net/hub/462167/file-2150080411-pdf/High_freq.pdf" type="submit" download></div>
</div>

Took the reference from: How to trigger a file download when clicking an html button or javascript

Also referred How do I provide a direct download link to a PDF file? But is there no way to use download tag of html or some solution? Thanks in advance

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘