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 get the response of a uploader?

    Help
    4
    5
    1436
    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.
    • P
      peterPanParker last edited by

      hi
      i am using q-uploader, i have already upload files but i don’t know how to get a json response that php is sending back… i have a @uploaded=“fileUploaded” listener:

      fileUploaded(file, xhr) {
      console.log(“Success upload”,file,xhr)
      this.$refs.uploader.reset();
      },

      i thougth that xhr argument would contain my json, i have checked in the browser console and the response properties like “response”, “response type” and “response text” are empty

      i can see my json returned in the network panel… but i don’t know how to access it
      anyone knows how?
      thanks for your time.

      1 Reply Last reply Reply Quote 0
      • B
        buzzokkin last edited by

        you can get it by accessing xhr “xhr.response”
        e.g.
        fileUploaded(file, xhr) {
        console.log(xhr.response)
        this.$refs.uploader.reset();
        },
        hope this helps 🙂

        1 Reply Last reply Reply Quote 0
        • P
          peterPanParker last edited by

          what works for me was:

          fileUploaded(file, xhr) {
          let response = JSON.parse(xhr.response)
          …
          }

          1 Reply Last reply Reply Quote 0
          • msfatgraycat
            msfatgraycat last edited by

            The response was received as an XMLHttpRequest object in the ‘file’ object.
            What I did was
            var r =new XMLHttpRequest()
            r = file.xhr
            console.log(r.response)

            1 Reply Last reply Reply Quote 0
            • D
              devmime last edited by

              @uploaded -> function(info) has a Parameter “info” which has wo props: “files” and “xhr”.
              When you are doing following it works.

              In the QUploader:
              @uploaded=“fileUploaded”

              and in the methods:
              fileUploaded ({ files, xhr }) {
              console.log(JSON.parse(xhr.response))
              }

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