1. 程式人生 > >非同步上傳檔案(formDate)

非同步上傳檔案(formDate)

var oMyForm = new FormData();
oMyForm.append("username", "Groucho");
oMyForm.append("accountnum", 123456); 
oMyForm.append("file", $('#file')[0].files[0]);

$.ajax({
    url: '/Manage/UploadImg',
    type: 'POST',
    cache: false,
    data: oMyForm,
    processData: false,
    contentType: false,
    async: 
false }).done(function(res) {}).fail(function(res) {});
 
 
轉自:http://www.cnblogs.com/zzgblog/p/5417969.html