用ajax上傳圖片,后臺(tái)說接收的數(shù)據(jù)一直是空 我這邊也不是很懂 第一次做圖片上傳 代碼如下 html<input type="file" class='file1'/>jqvar formData = new FormData(); $.each($('.file1')[0].files,function(i,file){ formData.append('file1', file);});$.ajax({ url: "upload_image.do", type: "POST", data:formData, cache:false, //不設(shè)置緩存 processData: false, // 不處理數(shù)據(jù) contentType: false, // 不設(shè)置內(nèi)容類型 dataType:"json", success : function(json){ if(json.response_code == 0 || json.response_code == "0"){//成功 console.log(json.response_data) }else{ } } });請問這么寫有沒有問題,怎么樣才能在前端看到我上傳的圖片的數(shù)據(jù)
ajax上傳圖片到后臺(tái),接受的數(shù)據(jù)一直顯示為空
慕工程0101907
2019-02-25 16:27:01