With AFNetworking I'm trying to upload an image (1280x990) with size: 33695. The code below works perfectly with smaller images (ie:390x390) but the larger image throws an error:
[client POST:@"/upload_image" parameters:nil constructingBodyWithBlock:^(id <AFMultipartFormData>formData) {
[formData appendPartWithFileData:imageData name:@"image" fileName:@"image.jpg" mimeType:@"image/jpeg"];
} success:^(NSURLSessionDataTask * task, id responderData) {
} failure:^(NSURLSessionDataTask * task, NSError * error) {
}];
ERROR thrown:
NSDebugDescription = "JSON text did not start with array or object and option to allow fragments not set.";
I've searched many other posts and there doesn't seem to be anything referring to issues with a larger image size. Any suggestions?
Based on the author of AFNetworking, plz use appendPartWithFileURL instead. Because the data will be stream from disk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With