summaryrefslogtreecommitdiff
path: root/client/js/services
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-09 15:33:52 +0100
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-09 15:33:52 +0100
commit8ad216dedf017f3d6de047a25d08db3b98e16361 (patch)
treefcec94698125460b47a47bd4e4db76428ba04d8b /client/js/services
parent3b569b6d008d5b1936ee04948cf5c1cc08790f39 (diff)
test
Diffstat (limited to 'client/js/services')
-rw-r--r--client/js/services/Image.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/client/js/services/Image.js b/client/js/services/Image.js
index 2e8c56f..decb5b2 100644
--- a/client/js/services/Image.js
+++ b/client/js/services/Image.js
@@ -44,6 +44,23 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){
};
+ var uploadImage=function(fileToUpload, callback) {
+
+
+ var result=$http.post('../server/index.php',
+ $.param({"token" : Identity.getToken(), "task" : "image", 'action':'uploadImage', 'filename':fileToUpload, 'id':'6564'}));
+
+ // Wait and handle the response
+ result.then(function (response){
+ callback(parseUploadImageAnswer(response, false));
+ },function(response){
+ callback(parseUploadImageAnswer(response, true));
+ });
+
+
+
+ }
+
var getData=function(response){
return data;
@@ -52,7 +69,8 @@ mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){
// Return services objects
return {
getImages:getImages,
- getData:getData
+ getData:getData,
+ uploadImage:uploadImage
};