前端上傳圖片file對象什么的都可以打印出來,但是后臺就是識別不到file對象上傳圖片的代碼如下<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>前端打印出來的file對象network中的數據:各位大神啊~這是咋回事啊,我已經接近崩潰了
前端上傳圖片,后臺識別不到file對象
瀟瀟雨雨
2019-03-21 14:19:03