Hi, I am trying to upload this image to the server, but for some reason I always end up in the fault with this error:
'400' [HTTP 400] <bad request>
Here is the function:
func upload(image: UIImage){
let path = "cards/\(AppDelegate.md5(string: backendless.userService.currentUser.getProperty("objectId") as! String))/\(currentTimeMillis()).png"
NSLog("path = \(path)")
let data:NSData = UIImagePNGRepresentation(image)!
backendless.fileService.upload(path, content: data, overwrite: false, response: { (uploadedFile: BackendlessFile!) in
//success
NSLog("FILE_UPLOAD_SUCCESS")
}) { (fault: Fault!) in
//fault
NSLog("FILE_UPLOAD_ERROR: \(fault)")
}
}
XCode Log:
2016-05-31 23:44:36.660 Cards[7323:4128744] path = cards/adf6aa61a6563856b6377f0d3a24c4e9/1464727476660.png
2016-05-31 23:44:46.154 Cards[7323:4128744] FILE_UPLOAD_ERROR: FAULT = '400' [HTTP 400] <bad request>