summaryrefslogtreecommitdiff
path: root/client/js/controllers/image
diff options
context:
space:
mode:
authorEoleDev <EoleDev@outlook.fr>2016-04-14 15:38:55 +0200
committerEoleDev <EoleDev@outlook.fr>2016-04-14 15:38:55 +0200
commit27730911d8c9253a4f5aa90450c57cdeca9d5d26 (patch)
treed431134576049226e36d8e92945333f5a59186d1 /client/js/controllers/image
parentc32933b362874d99207a4305d09b203dcbf20585 (diff)
parent237b627bf6cdf31e8923fc67653a73b6b9978540 (diff)
Merge commit '237b627' into develop
Diffstat (limited to 'client/js/controllers/image')
-rw-r--r--client/js/controllers/image/image.js3
-rw-r--r--client/js/controllers/image/upload.js60
2 files changed, 60 insertions, 3 deletions
diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js
index b0b162b..d9a9c06 100644
--- a/client/js/controllers/image/image.js
+++ b/client/js/controllers/image/image.js
@@ -11,9 +11,6 @@ mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', funct
Loading.stop();
};
- $scope.doUpload = function () {
- Image.uploadImage($scope.myFile,function(){});
- };
if(Identity.isAlreadyLogin()){
diff --git a/client/js/controllers/image/upload.js b/client/js/controllers/image/upload.js
new file mode 100644
index 0000000..eca9406
--- /dev/null
+++ b/client/js/controllers/image/upload.js
@@ -0,0 +1,60 @@
+/**
+ * The image controller
+ *
+ * @param {$scope} $scope The $scope service from angular
+ */
+mainApp.controller('uploadImageCtrl', ['$scope', 'Image', 'Loading', 'Identity', 'upload', function ($scope, Image, Loading, Identity,upload)
+{
+ /*$scope.uploader = new FileUploader({
+ "token" : Identity.getToken(),
+ "task" : "image",
+ 'action':'uploadImage',
+ 'id':'6564'
+ });
+ $scope.uploader.url='../server/index.php'
+ $scope.uploader.alias='file_name'
+ $scope.uploader.formData={
+ "token" : Identity.getToken(),
+ "task" : "image",
+ 'action':'uploadImage',
+ 'id':'6564'
+ }
+ */
+
+ $scope.doUpload = function () {
+ console.log($('#imageToUpload').prop('files')[0]);
+ Image.uploadImage($('#imageToUpload').prop('files')[0], function(){alert("done")})
+ /*$("#drop-area-div").dmUploader({
+ extraData: {
+ "token" : Identity.getToken(),
+ "task" : "image",
+ 'action':'uploadImage',
+ 'id':'6564'},
+ url:"../server/index.php"
+ });
+ */
+
+ /*upload({
+ url: '../server/index.php',
+ method: 'POST',
+ data: {
+ "token" : Identity.getToken(),
+ "task" : "image",
+ 'action':'uploadImage',
+ 'id':'6564',
+ "file_name": $scope.myFile, // a jqLite type="file" element, upload() will extract all the files from the input and put them into the FormData object before sending.
+ }
+ }).then(
+ function (response) {
+ console.log(response.data); // will output whatever you choose to return from the server on a successful upload
+ },
+ function (response) {
+ console.error(response); // Will return if status code is above 200 and lower than 300, same as $http
+ }
+ );*/
+
+
+ };
+
+
+}]);