你的位置:首页 > 软件开发 > Java > 表单文件上传与文件下载

表单文件上传与文件下载

发布时间:2015-05-04 16:00:23
一、简介  使用form表单进行需要为form添加enctype="multipart/form-data" 属性,除此之外还需要将表单的提交方法改成post,如下 method="post"。二、示例  1、表单文件上传  网页代码如下: ...

一、简介

  使用form表单进行需要为form添加enctype="multipart/form-data" 属性,除此之外还需要将表单的提交方法改成post,如下 method="post"。

二、示例

  1、表单文件上传

  网页代码如下:

 1 <!DOCTYPE html> 2 <html> 3 <head> 4 </head> 5 <body>     6   <form action="${pageContext.request.contextPath}/file/upload.action" method="post" enctype="multipart/form-data"> 7     <div id="contentTable" style="border: 0px;"> 8       <h1 class="title" style="font-size: 15px; border-bottom: 1px solid #DFE3E6;">导入数据</h1> 9       <table width="80%">10       <tr>11         <td width="20%"align="right">12         选择要上传的文件 13          </td> 14         <td width="70%" id="name_h" title="" style="text-align: center;"> 15         <input type="file" name="xlsfile" id="xlsfile" />16         </td>17         </tr>18       </table>19       <div id="activityTable">20         <input id="btnSave" type="submit" value="导&nbsp;入" />21       </div>22     </div>23   </form>24 </body>25 </html>

 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:表单文件上传与文件下载

关键词:上传

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。