Q-uploader Manually Add Files



  • Hi there,

    Do you have any sample on how to manually add files? I have successfully uploaded the images but repopulating it seems confusing.

    My code:

    mounted(){
    if (this.locProduct.images != null) {
          for (var i = 0; i < this.locProduct.images.length; i++) {
            let fileName = this.locProduct.images[i].name
            let url = this.locProduct.images[i].path_url
    
            // Add file size to the database images
            let file = {
              id: this.locProduct.images[i].id,
              size: 123,
              type: fileName.split('.').pop(),
              name: fileName,
              __img: {
                src: url
              }
            }
            console.log(file)
            this.added([file])
          }
        }
    }
    
    methods: {
    added (files) {
          console.log(files)
          this.selectedFile.push(files[0])
        },
    }
    


  • I solved this by

    this.$refs.uploader.addFiles([file])


Log in to reply