Last active
March 21, 2016 21:14
-
-
Save ahilles107/b5d7edde0db3c3489a16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.submit = function() { | |
$scope.upload($scope.file); | |
}; | |
// upload on file select or drop | |
$scope.upload = function (file) { | |
Upload.upload({ | |
url: 'upload/url', | |
data: {file: file, 'username': $scope.username} | |
}).then(function (resp) { | |
console.log('Success ' + resp.config.data.file.name + 'uploaded. Response: ' + resp.data); | |
}, function (resp) { | |
console.log('Error status: ' + resp.status); | |
}, function (evt) { | |
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total); | |
console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment