No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How can i append Q-file items to FormData

    Framework
    2
    2
    546
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      maotheniger last edited by

      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" } }
        );
      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @maotheniger last edited by

        @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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post