-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uploadMultiple doesnt seem to work #22
Comments
The If you set it to |
in this case, how do i limit to one file per upload yet allow for multiple uploads 'per session'? |
Setting the VueClip instance's |
Resetting the <vue-clip v-if="showUploader"></vue-clip> methods: {
reset: function() {
var vm = this;
vm.showUploader = false;
Vue.nextTick(function() {
vm.showUploader = true;
});
}
} I would very much prefer a |
@cb109 Have you tried |
P.S. I'd rather merge than fork, but I'm working on making this a little more esNext compliant here: https://github.com/alexsasharegan/vue-clip. I'm also leaning towards more idiomatic vue code—one example being emiting the Dropzone events right of the component rather than using a matching set of callbacks. I think the component can also stay lighter that way. Contributions or feedback welcome. I work for a print company, so I have a constant need for file upload components. I'm working to push our front-end stack to Vue.js, so I will intend on maintaining something after I ship our e-commerce site refresh. |
@alexsasharegan Yes I tried that, it rendered the instance unusable for me, which was bad because it's part of a modal dialog that needs to work more than once. So far my hack above seems to do the job. |
P.S. @vafl-brut I think you could set |
@cb109 I see what you're doing now, basically forcing Vue to garbage collect the existing instance and make a fresh one. Is it just error messaging you need clear? Maybe you could include more of your modal code. I don't see any Dropzone methods to clear an error message, but I feel like that is something you would display "manually" in your component. |
@vafl-brut If you need something more dynamic, I bet you could set ...or use the Maybe I'm overthinking it though. Seems parallelUploads or some options should be the right way. |
Any news? I do have the same issue, as being able to load one file per upload (for avatar), but multiple times per session (as someone would want to change his avatar pic more than once per session). |
@electronrecord I believe in that use case you want to set these options: {
uploadMultiple: false, // default
parallelUploads: 1 // defaults to 2
} Although I believe Dropzone.js might be pushing us into a corner due to this little bit of logic: if ((this.options.maxFiles == null) || this.options.maxFiles > 1) {
this.hiddenFileInput.setAttribute("multiple", "multiple");
} We want to leave off the multiple attribute, but accept more than one max file. If you can dive into the dom and grab the hidden input, you should be able to reverse this with something like this: document.querySelector('.dz-hidden-input').removeAttribute("multiple") The other alternative is ugly and requires you to put a ref on your vue-clip component, but I think it looks like this: {
// inside your component using vue-clip
// add ref="vue_clip" to the vue-clip in your template
mounted() {
this.$refs.vue_clip.uploader._uploader.hiddenFileInput.removeAttribute("multiple")
}
} |
And please, let us know if anything works! Let's try and leave a clear solution for whoever comes after and has the same issue. |
See here for the |
Well, for me the working thing is to put a v-if directive on vue-clip, and execute it (toggle a var like isVueClip from true - false - true) from the complete function (the one which tells that the upload is completed), with a setTimeout of 10 ms. It works fine, so i'm happy with this for the moment, cause i do not have the time to dig the inside code. |
Hello!
Great plugin, thanks!
One problem so far - setting uploadMultiple: false doesnt seem to have any effect - Im still able to select multiple files in the file selector dialog. However, setting maxFiles: 1 does the trick but I have to clear files on upload to allow for re-upload. Is this just me or this behavior is counter-intuitive ?
Thanks!
The text was updated successfully, but these errors were encountered: