How do you upload a file onto the cloud for a specific user with corona sdk?

0 votes

Hi,

 

I was trying to upload a file for a user to the cloud using the API but it keeps returning an error. Below is my code.

 

userFilename = "db.sqlite"
fileDescription = "UserDataFile"     
filePath = system.pathForFile(nil, system.DocumentsDirectory)
fileType = UploadFileType.OTHER
print ("user document path:"..filePath)
local App42CallBack = {}  
App42API:initialize(Constants.apiKey,Constants.secretKey)  
local uploadService  = App42API:buildUploadService()
print ("OKOKOKOK")  
uploadService:uploadFileForUser(userFilename,mobileNumber,filePath ,fileType,fileDescription,App42CallBack)   
function App42CallBack:onSuccess(object)  
    print("FileName is :".. object:getFileList():getName());   
    print("UserName is :".. object:getFileList():getUserName());   
    print("Type is :".. object:getFileList():getType());       
    print("Url is :".. object:getFileList():getUrl());    
    print("Description is: ".. object:getFileList():getDescription());     
end    
function App42CallBack:onException(exception)  
    print("Message is : "..exception:getMessage())  
    print("App Error code is : "..exception:getAppErrorCode())  
    print("Http Error code is "..exception:getHttpErrorCode())  
    print("Detail is : "..exception:getDetails())  
end  
 
The error returned is as below:
 
16:01:18.132  ERROR: Runtime error
16:01:18.132  E:\Boss Rewards\App42-Lua-API\MultipartFormData.lua:65: assertion failed!
16:01:18.132  stack traceback:
16:01:18.132   [C]: in function 'assert'
16:01:18.132   E:\Boss Rewards\App42-Lua-API\MultipartFormData.lua:65: in function 'getBody'
16:01:18.132   E:\Boss Rewards\App42-Lua-API\RestConnector.lua:223: in function 'multiPartRequest'
16:01:18.132   E:\Boss Rewards\App42-Lua-API\UploadService.lua:66: in function 'uploadFileForUser'
16:01:18.132   E:\Boss Rewards\UserLogin.lua:797: in function <E:\Boss Rewards\UserLogin.lua:735>
16:01:18.132   ?: in function <?:205>
 
 
Can you please help?
 
Thanks.

 

asked Jun 9, 2016 in Corona by tianchoh (10 points)

1 Answer

0 votes
Hi Toh,

 

We have forwarded this query to our production team and they are looking into it. We will get back to you on this ASAP.

 

Regards,

Himanshu Sharma
answered Jun 9, 2016 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
...