I'm using dropzone.Js inside a Vue component and I'm trying to submit the form in which the dropzone is only after submit button is clicked.
HTML:
<div class="form-group">
<label for="dropzone-js" class="col-md-12 control-label">Choose a profile picture:</label>
<!-- even though there is not path in the action there is still a post request -->
<form action="#"
class="dropzone"
id="dropzone-js"></form>
</div>
The print screen:
Vue component script:
ready(){
// I´ve tried to implement the autoProcessQueue to false in many ways, but
// withouth the desired result
Dropzone.forElement(".dropzone").options.autoProcessQueue = false;
Dropzone.options.autoProcessQueue = false;
new Dropzone('#dropzone-js', {
paramName: "profileImg", // The name that will be used to transfer the file
maxFilesize: 2, // MB
maxFiles: 1,
autoProcessQueue:false,
autoProcessQueue: false,
uploadMultiple: false,
accept: function(file, done) {
console.log('event',event)
console.log('accepted dropzone file', file)
this.form.photo = file
// done();
},
init: function() {
this.on("addedfile", function(file, event) {
// this.form.photo = file
// alert("Added file.");
console.log('event',event)
});
},
init: function() {
this.on("maxfilesexceeded", function (file) {
alert('Only 1 file allowed')
this.removeFile(file);
});
}
})
},
I'm still not sure what I'm missing here, but as it's the first time I'm using both, I'm quite lost on usage specifications.
I found a work-around, which I would guess is not recommended. If someone knows a better one, please comment.
I had to edit the dropzone.js source code and set the autoProcessQueue = false
, like so:
I think the local setting of the dropzone object is not being able to override the global autoProcessQueue config.