Fixed Warning
authorFulup Ar Foll <fulup@iot.bzh>
Mon, 21 Dec 2015 15:10:40 +0000 (16:10 +0100)
committerFulup Ar Foll <fulup@iot.bzh>
Mon, 21 Dec 2015 15:10:40 +0000 (16:10 +0100)
afb-client/app/Frontend/pages/Sample/Sample.html
afb-client/app/Frontend/widgets/FormInput/UploadFiles.js

index 7461d49..03a4558 100644 (file)
@@ -25,10 +25,10 @@ animationIn: slideInRight
     </upload-image>
     
     <!-- Warning: name=xxx should match with what server expect [used as xform input name -->
-    <upload-audio  name=music posturl="/api/post/upload-music" callback="ctrl.FileUploaded" title="Upload your Music"></upload-audio>
+    <upload-audio  name="music" posturl="/api/post/upload-music" callback="ctrl.FileUploaded" title="Upload your Music"></upload-audio>
 
     <!-- Warning: name=xxx should match with what server expect [used as xform input name -->
-    <upload-appli  name=appli posturl="/api/post/upload-appli" callback="ctrl.FileUploaded" title="Upload AGL App"></upload-appli>
+    <upload-appli  name="appli" posturl="/api/post/upload-appli" callback="ctrl.FileUploaded" title="Upload AGL App"></upload-appli>
 
 </div>
 
index 8bc8eca..8c0a4c2 100644 (file)
@@ -43,8 +43,12 @@ var tmpl =  '<input type="file" name="{{name}}-input" onchange="angular.element(
 function LoadFileSvc (scope, elem, posturl, files, thumbnailCB) {
     var xmlReq = new XMLHttpRequest();
     var xform  = new FormData();
-
-    // Update slider during Upload
+    
+    var OnLoadCB = function (target) {
+        var status = thumbnailCB (target);
+        //if (status) xform.append(scope.name, file, file.name);
+    };
+            // Update slider during Upload
     xmlReq.upload.onprogress = function (event) {
         var progress = Math.round(event.lengthComputable ? event.loaded * 100 / event.total : 0);
         if (scope.slider) scope.slider.setValue (progress);
@@ -110,10 +114,7 @@ function LoadFileSvc (scope, elem, posturl, files, thumbnailCB) {
         if (thumbnailCB) {
             var reader = new FileReader();
             reader.readAsArrayBuffer(file);
-            reader.onload = function (target) {
-                var status = thumbnailCB (target);
-                //if (status) xform.append(scope.name, file, file.name);
-            };
+            reader.onload = OnLoadCB;
         } 
         // if everything is OK let's add file to xform
         xform.append(scope.name, file, file.name);