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

    Best Approach To Upload image using <q-uploader>

    Help
    3
    3
    3579
    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.
    • Y
      yschin last edited by

      I need to upload an image by using <q-uploader>, but i still have some input field need to be fill in by user, so i plan when user clicked submit button, image and those data will upload to sever together. So i hide the upload button from <q-uploader> and i need upload the image by using that submit button, how to i trigger the <q-uploader> upload event when I click that submit button? Thank in advance!

      1 Reply Last reply Reply Quote 0
      • E
        edudesouza last edited by benoitranque

        Quite simple:

        <q-uploader 
                  :url="upload"
                  :labels = "{add:'Selecionar arquivo',remove:'Remover',upload:'Enviar',failed:'ERRO',uploading:'Enviando'}"      
                  :additionalFields = "[
                    {'name':'id_cliente','value':this.id_cliente},
                    {'name':'id_usuario','value':this.id_usuario},
                    {'name':'url','value':this.url},
                    {'name':'token','value':this.token},
                    {'name':'categoria','value':this.form.categoria},
                    {'name':'titulo','value':this.form.titulo},
                    {'name':'email','value':this.form.email},
                    {'name':'telefone','value':this.form.telefone},
                    {'name':'comentario','value':this.form.comentario},
                  ]"
                  :hide-upload-button = "true"
                  @finish = "upload_ok"
                  @fail   = "upload_erro"           
                  buttonClass="bg-green-7 radius04 text-white"
                  ref="uploader">         
        </q-uploader>
        

        then after some validation you call

        this.$refs.uploader.upload();
        
        1 Reply Last reply Reply Quote 3
        • syflex
          syflex last edited by

          @edudesouza this helps a lot

          thanks

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