Skip to content Skip to sidebar Skip to footer

How Upload File Using Dropzone & Vuejs

hy help me please.. I'm Using DropzoneJs & vueJs, I want upload file in vueJs using dropzone.js but doesnt work, I have try like this & msg error uploadImageGallery.option

Solution 1:

  • move the function into your methods so you can access the vm via this
  • use new Dropzone() to create the Dropzone instance instead of $().dropzone?
  • save the new instance as a vm property instead of a variable
  • access it in other methods through that property

Like this:

var vmGallery = newVue({

  el: '#GalleryController',
  data: {},

  methods: {
      AddGallery() {
        console.log('add');
        // access dropzone instance through vm propertythis.uploadImageGalleryVar.options.autoProcessQueue = true;
        this.uploadImageGalleryVar.processQueue();
      },

      // move function into yor methods.uploadImageGallery() {
        Dropzone.autoDiscover = false;
        // save dropzone instance as vm property// use new Dropzone() to create it instead of jQuery shortcutthis.uploadImageGalleryVar = newDropzone($(".upload__button__news"), {
          url: base_url + "/myRoute",
          addRemoveLinks: true,
          dictCancelUpload: "",
          autoProcessQueue: false,
          dictRemoveFile: "x"
        });
      }
  },

  ready: function() {
    uploadImageGallery();
  }
});

That's it

Post a Comment for "How Upload File Using Dropzone & Vuejs"