1. 程式人生 > >H5用FormData物件提交表單及上傳檔案

H5用FormData物件提交表單及上傳檔案

1、如何使用
use multipart/form-data when your form includes any <input type="file"> elements.

2、怎麼用ajax獲取傳遞

var formdata = new FormData();  
formdata.append('name','fdipzone');  
formdata.append('gender','male');  
//或者
var form = document.getElementById('form1');  
var formdata = new FormData(form);