/ Published in: JavaScript
URL: http://fatfolderdesign.com/208/hacks/valums-ajax-file-upload-single-item-fix
There's a small error in valums ajax upload script (http://valums.com/ajax-upload/). When set to not allow multiple uploads droping multiple files on the script will still upload them all at once. The below is a fix I came up with, replace line 574 with the for if statment
Expand |
Embed | Plain Text
var key; var cnt=-2; // Not sure why it's always adding 2 but it _always_ is. for (key in e.dataTransfer.files) { cnt++; } if(self._options.multiple==false && cnt>1){ self._options.showMessage('You may only upload 1 file at the site, please deselect '+(cnt-1)+' images and try again.'); }else{ self._uploadFileList(e.dataTransfer.files); }
You need to login to post a comment.
