4
我需要通過Axios發送文件從客戶端到服務器。如何通過Axios發送文件到Laravel
這裏是我的Vuejs代碼:
methods: {
'successUpload': function (file) {
const config = { headers: { 'Content-Type': 'multipart/form-data' } };
axios.post('/Upload/File',file, config).then(function (response) {
console.log(response.data);
});
}
}
這裏是我的處理代碼Laravel發送文件:
但它總是返回No It's not a File
。
任何幫助將不勝感激。
你能告訴你如何調用'successUpload'嗎? –
我正在使用Dropzonejs上傳文件 –
僅供參考,但如果您使用的是dropzone,則不需要使用axios來上傳文件。 –