form表单提交文件(input file)

 

包含文件上传的form表单提交,要添加属性 enctype="multipart/form-data"

 


<form method="post" id="create_form" action="" enctype="multipart/form-data">
  <table style="display: table;">
    <tr>
      <td>任务名称:</td>
      <td><input type="text" id="taskName" name="taskName" maxlength="40"></td>
    </tr>
    <tr>
      <td">操作说明:</td>
      <td><input type="file" id="instructions" name="instructions"></td>
    </tr>
    <tr>
      <td colspan='2'>
        <div>
          <button type="button" id="submit-btn">提交</button>
        </div>
      </td>
    </tr>
  </table>
</form>

 

$("#submit-btn").click(
    function(e){
    $("#create_form").submit(); } )

 

posted @ 2019-10-24 14:59  Fourteen  阅读(16280)  评论(0编辑  收藏  举报