包含文件上傳的form表單提交,要添加屬性 enctype="multipart/form-data"post
<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>spa
$("#submit-btn").click( function(e){ $("#create_form").submit(); } )