javascript upload problem

0 votes

hi, if i upload image via this javascript function

App42.initialize("XXXXXXXXXXX", "XXXXXXXXXXXX");
var uploadService = new App42Upload();
uploadService.uploadFileForUser("avatar", authData.username.value, "/home/nessuno/myApp/www/img/avatar.png", "IMAGE", "image",
 {    
         success: function(object)    
          {   
                alert("ok");
                var uploadObj = JSON.parse(object);    
                console.log("name is " + uploadObj.app42.response.upload.files.file.name);  
                console.log("file type is" + uploadObj.app42.response.upload.files.file.type); 
                console.log(" url is" + uploadObj.app42.response.upload.files.file.url); 
          },    
          error: function(error) { alert(error); }            
 });

i received this error the parameter file cannot be null or empty
 
the image path its ok. and, if I put it absolute or relative path ("img/avatar.png") the function does not work.
i use ionic framework with angularjs. i lost one day with this problem and i dont know how to fix it
asked Oct 22, 2015 in App42 Cloud API-BaaS by asasolagroup (8 points)
edited Oct 22, 2015 by asasolagroup

1 Answer

0 votes

Hello Developer,

Please have a look at this sample, this will help you to upload your file using javascript api. 

Let me know if you face any issue.

regards,

Himanshu Sharma

answered Oct 22, 2015 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...