File Upload AJAX

This commit is contained in:
Eole 2016-05-09 22:39:49 +02:00
parent a7d79d60ab
commit 77ba8021bc
4 changed files with 36 additions and 10 deletions

13
client/js/controllers/image/edit.js Normal file → Executable file
View file

@ -20,6 +20,17 @@ mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', '
$scope.axioms = axioms;
$('#editImageModal').modal('show');
$("#fileupload").fileupload({
formData: {task: "image", token: Identity.getToken(), action: "uploadImage", id: $scope.data.id},
/* ... */
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .bar').css(
'width',
progress + '%'
);
}
});
});
$scope.applyEdition = function (id) {
@ -34,4 +45,6 @@ mainApp.controller('editImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', '
$scope.getToken = function () {
return Identity.getToken();
}
}]);