前端上傳圖片file對(duì)象什么的都可以打印出來(lái),但是后臺(tái)就是識(shí)別不到file對(duì)象上傳圖片的代碼如下<template> <div class="upload"> <div class="upload_warp_upload"> <span v-for="(item,index) of imgList" class="upload_span"> <img :src="item.url"> <span @click="fileDel(index)" class="upload_del"></span> </span> <div class="upload_warp_left" @click.stop="fileChange"> <span>+</span> </div> </div> <input accept="image/*" @change.stop="fileChange($event)" type="file" id="upload_file" style="display: none"/> </div> </div></template><script> export default { data(){ return { imgData:[], imgList: [], size: 0, } }, methods:{ fileClick() { document.getElementById('upload_file').click(); }, fileChange() { let reader = new FileReader(); let file = e.path[0].files[0]; reader.readAsDataURL(file); let that = this; reader.onloadend = function () { let url = reader.result; that.imgList.push({url: url, name :file.name}); that.$messageBox('成功'); that.imgData.push(file); that.$emit('imageListChange', that.imgData); }; }, fileDel(index) { this.imgList.splice(index, 1); }, } }</script>前端打印出來(lái)的file對(duì)象network中的數(shù)據(jù):各位大神啊~這是咋回事啊,我已經(jīng)接近崩潰了
前端上傳圖片,后臺(tái)識(shí)別不到file對(duì)象
瀟瀟雨雨
2019-03-21 14:19:03