首页 > 编程知识 正文

Vue上传文件 普通参数,layui上传文件携带参数

时间:2023-05-04 14:05:57 阅读:245624 作者:73

/* Submits files to the server */ submitFiles(){ /* Initialize the form data */ let formData = new FormData(); /* Iteate over any file sent over appending the files to the form data. */ for( var i = 0; i < this.files.length; i++ ){ let file = this.files[i]; formData.append('picture', file); formData.append('name',"测试课程"); formData.append('introduction',"这说vd"); } /* Make the request to the POST /select-files 羞涩的牛排/ this.$axios.post( '/teacher/createCourse', formData,{ headers: { 'Content-Type': 'multipart/form-data' }}, ).then(function(){ console.log('SUCCESS!!'); }) .catch(function(){ console.log('FAILURE!!'); }); },

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。