关于fromdata的上传文件问题

1 <div class="imgDIv"> 2 <label>上传pdf</label> 3 <input id="fileId" type="file" accept="application/pdf" class="imgPic"/> 4 </div>

1 var formData = new FormData();
 2     var file = $("#fileId")[0].files[0];
 3     formData.append('file', file);
 4     $.ajax({
 5         type:'POST',
 6         url:Feng.ctxPath + "/catalog/add",
 7         data:formData,
 8         dataType: "formData",
 9         cache: false,
10         contentType: false,
11         processData:false,
12         mimeType:"multipart/form-data",
13         success:function(data){
14             if(data.code==200){
15                 layer.msg("保存成功!");
16                 window.parent.Catalog.table.refresh();
17             }else{
18                 layer.msg(data.msg)
19             }
20         }
21     });
(0)

相关推荐