How can i append Q-file items to FormData
-
Hello Friends;
i have a Qfile picker. I selected some files with it. After selection i need to send data to node service. I am using in node service multer. After append QFile selection on Form data and sent with axios multer give me “MulterError: Unexpected field” error. How can i append Qfile picker selection ?<q-file outlined :max-files="5" hint="5 Adet Resim Seçebilirsiniz." v-model="form.urun_resim_list" placeholder="Resim Seçiniz" multiple append counter :filter="checkFileType" :max-total-size="2000000" > <template v-slot:prepend> <q-icon name="cloud_upload" @click.stop /> </template> </q-file> var fd = new FormData(); this.form.urun_resim_list.forEach((element) => { console.log(element); fd.append("images", element); }); let data = await this.$axios.post( "/EcommerceManagement/addProducts", fd, { headers: { "Content-Type": "multipart/form-data" } } );
-
@maotheniger You may want to check the network tab when you make the POST request. The code looks okay from the Quasar side, but if you check the network tab you should see if it’s a multer problem or an axios problem.