danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

Unordered list is cleared when an invalid filetype is dragged and dropped #2016

Open chriswrightnomuda opened 6 years ago

chriswrightnomuda commented 6 years ago

capture

angular.module('app',['ngFileUpload']); angular.module('app').controller('myController', ['$scope', 'Upload', function ($scope, Upload) { $scope.fruits = ["Apple", "Banana", "Cherry", "Lemon","Melon","Orange","Peach","Raspberry","Strawberry"];

    `$scope.uploadFiles = function (files) {
        if (files && files.length) {
            for (var i = 0; i < files.length; i++) {
                Upload.upload({url: 'upload/url', data: {file: files[i]}, 'username': "Me"});
            }
        } else {
            alert("Where did my list go?");             
        }
    }
}

])