Vue-dropzone: manuallyAddFile not working

Created on 14 Sep 2018  路  7Comments  路  Source: rowanwins/vue-dropzone

Hello there,
I tried to implement vue-dropzone like it is described in the manual, but when I want to add files manually I got following error message:

vue2Dropzone.js:1 Uncaught TypeError: Cannot read property 'match' of undefined
at VueComponent.manuallyAddFile (vue2Dropzone.js:1)
at VueComponent.onAddImages (TripReportItem.vue:115)
at invoker (vue.esm.js:2027)
at HTMLDivElement.fn._withTask.fn._withTask (vue.esm.js:1826)

Do you have any idea what went wrong? I have implemented the component as follows:

template;
<vue-dropzone ref="myVueDropzone" id="vueDropzone" :options="dropzoneOptions"> </vue-dropzone>

and in the methods
onAddImages:function(){ var file = { size: 555, name: "1.jpg"}; var url = "http://www.gstatic.com/webp/gallery/2.jpg"; this.$refs.myVueDropzone.manuallyAddFile(file, url) },
this function would be bound via click handler to a button (just for testing purposes)

Thank you in advance

Most helpful comment

This is an upstream exception, see PR for a fix you can apply yourself

All 7 comments

This is an upstream exception, see PR for a fix you can apply yourself

That saves my weekend !! Thank you very much, now it works.

Thank you @eljefedelrodeodeljefe !

Try to add type in file object!

javascript var file = { size: 123, name: "Icon", type: "image/png" }; var url = "https://myvizo.com/img/logo_sm.png"; this.$refs.myVueDropzone.manuallyAddFile(file, url);

its not working in loop.

this.staticForm.attaches = res.data.aircraft.attaches
                    // console.log(this.staticForm.attaches)
                    let attaches = res.data.aircraft.attaches

                    if(attaches.length>0){
                        for (let i=0; i<attaches.length;i++){
                            let file = {name: attaches[i].original_file_name, contentId:attaches[i].id, size:123}
                            this.$refs.viewDropZone.manuallyAddFile(file,'/storage/'+attaches[i].path+'/'+attaches[i].original_file_name)
                        }
                    }

dropzone-error

@MicroDreamIT I had the same issue with loop I added type: "image/jpg" to the mock

Hope this video will help you. The video is short and to the point. https://www.youtube.com/watch?v=zoA5tizAa2w

Was this page helpful?
0 / 5 - 0 ratings