Skip to content
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

Issue with auto upload. #66

Open
janjanarnaldo opened this issue Jul 28, 2017 · 0 comments
Open

Issue with auto upload. #66

janjanarnaldo opened this issue Jul 28, 2017 · 0 comments

Comments

@janjanarnaldo
Copy link

janjanarnaldo commented Jul 28, 2017

Is there a way that we can add multiple files and upload it directly without having an upload button? The requirement is drag/drop and droplet-upload-multiple and after adding the files it should upload automatically. I've tried putting the interface.uploadFiles() inside $dropletFileAdded but it's some sort of a wacky stuff because $dropletFileAdded listener executes as much number as the files are, that means if I upload 2 files, the interface.uploadFiles() will execute twice, first with single file, second with 2 files. The easier approach is if it's possible for us to identify how many files are added or dropped in the first place so we could just use _.size(interface.getFiles()) inside $dropletFileAdded and compare with how many files are added before calling the interface.uploadFiles() stuff. Please have a look at the sample code below

$scope.$on('$dropletFileAdded', function(event, file){ if (file.type & $scope.interface.FILE_TYPES.INVALID) { // Recently added file is invalid... toaster.pop('error', 'Invalid', 'Bad file type added'); } else { if(!$scope.interface.isUploading()) { $scope.interface.uploadFiles(); } } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant