javascript - How to disable Dropzone.js after choosing file? -
in dropzone first choose file save, , click save button save it. so, questuion is: how can disable dropzone area after choosing file? i've tried this
accept: function (file, done) { if (file.type != "image/jpeg" && file.type != "image/png" && file.type != "image/gif") { $('.file-row').find('img').attr('src', '/../content/images/decline.png'); $('.file-row').find('img').attr('class', 'error-img'); done("error! files of type not accepted"); } else { $('.file-row').find('img').attr('src', '/../content/images/accept.png'); $('.file-row').find('img').attr('class', 'accept-img'); done(); logodropzone.disable(); } }
but code don't allow me upload file, "upload canceled" error pops-up. can do?
better use standart dropzone.js events. documented here. can simple hide , show input
logodropzone.on("addedfile", function (file) { $('.dz-input').hide(); }) logodropzone.on("deletedfile", function (file) { $('.dz-input').show(); })
Comments
Post a Comment