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.