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

    Uploader - url is required?

    Framework
    8
    13
    1225
    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.
    • metalsadman
      metalsadman last edited by

      Did you pass a url in your factory?

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

                uploadFactory(file) {
                                let vm = this,
                                    data = new FormData();           
                                return new Promise((resolve, reject) => {            
                                    this.$axios.post('/upload', data, {            
                                            headers: { 'Content-Type': 'multipart/form-data' }            
                                        })            
                                        .then(response => {                                        
                                            resolve(file);            
                                        })            
                                        .catch(error => reject(error))            
                                });            
                            }
        1 Reply Last reply Reply Quote 0
        • matroskin
          matroskin last edited by

          Any suggestions?

          O 1 Reply Last reply Reply Quote 0
          • O
            owrasor @matroskin last edited by

            @matroskin Im getting the same error. Did you solved the problem?

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

              Nope… Maybe I should send issue?

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

                Interesting… In my code above, I changed resolve(file) to resolve(null)
                It works, axios sending and no errors in console

                1 Reply Last reply Reply Quote 0
                • S
                  SyFab last edited by

                  When I call “resolve(null)”, I have no errors in console, but the q-uploader-component shows me an error (red exclamation mark).
                  I don’t have an upload server either, the whole file processing takes place in the client.

                  andrepestana 1 Reply Last reply Reply Quote 1
                  • L
                    LIANG FENG last edited by

                    Hi,

                    Is there any update for this issue? I have the same problem.

                    Thanks
                    BR

                    1 Reply Last reply Reply Quote 0
                    • G
                      gt7282538 last edited by

                      Hi,

                      I’m getting the same error, any suggestion ?

                      Thanks,
                      Jack

                      1 Reply Last reply Reply Quote 0
                      • andrepestana
                        andrepestana @SyFab last edited by

                        @SyFab said in Uploader - url is required?:

                        When I call “resolve(null)”, I have no errors in console, but the q-uploader-component shows me an error (red exclamation mark).
                        I don’t have an upload server either, the whole file processing takes place in the client.

                        I also would like to use q-uploader as a file selection and manipulate them with javascript. There’s no real upload to a server. Is there any ticket to change this already?

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

                          I solved it here: I didn’t set any url prop to q-uploader nor used a factory function. I just hid the upload button and got the @added event:

                          <template>
                            <q-page class="flex flex-center">
                               <q-uploader
                                  style="width: 100%;"
                                  label="Restricted to images"
                                  multiple
                                  accept=".jpg, image/*"
                                  :hide-upload-btn="true"
                                  @added="onAdded"
                                />
                            </q-page>
                          </template>
                          
                          <script>
                          export default {
                            methods: {
                              onAdded: function(files) {
                                console.log(files)
                              }
                            }
                          }
                          </script>
                          
                          1 Reply Last reply Reply Quote 1
                          • Allan-EN-GB
                            Allan-EN-GB Admin last edited by

                            Yeah, that’s the way. I do it in my project.

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