when i upload image on server than i am getting this Error “FAULT = ‘0’ [HTTP 0] <server error>”
Hi Pratik,
Could you please describe how you upload a file (using console or API, if the latter please show the code you use to upload a file).
Regards,
Mark
Hello Mark,
I am upload image using folowing method.but not work…
NSString *fileName = [NSString stringWithFormat:@“img/%0.0f.jpeg”,[[NSDate date]timeIntervalSince1970] ];
BackendlessFile *uploadFile = [backendless.fileService upload:fileNamecontent:UIImageJPEGRepresentation(mainImage, 0.1)];
Thanks, Pratik. I assigned it to a developer for investigation.
Regards,
Mark
Hi Pratik,
I checked this function with our FileService sample, it works fine for me.
Try to run our sample, will it work with your Backendless appId and secretKey?
Another way is to send your project (without ‘lib’ folder) to support@backendless.com, we’ll investigate this issue with it.
Regards,
Slava
Hi Guys,
I am also facing the same problem while uploading image using swift code (iOS SDK).
Can you please help ?
Thanks,
Dinesh
First, update the latest Backendless SDK (pod 3.0.41) and try again. And please provide your sample code, which demonstrates this issue.
Hi Slava,
I updated pods to 3.0.41 now, but I am still getting the same error.
Here is my code snippet.
let fileName = "restaurant_images/BG_image_(NSDate().timeIntervalSince1970)_%0.0f.jpg"
Types.tryblock({
let file = Backendless.sharedInstance().fileService.upload(fileName, content: NSFileManager.defaultManager().contentsAtPath(image), overwrite: true)
shopBgImageUrl = file.fileURL
}) { (error) in
print(error)
// show error here
}
Thanks,
Dinesh
Please try ‘saveFile’ method instead “upload”:
let file = Backendless.sharedInstance().fileService.saveFile(fileName, content: NSFileManager.defaultManager().contentsAtPath(image), overwriteIfExist: true)
Thanks a lot , yes SaveFile is working