Note that there are some explanatory texts on larger screens.

plurals
  1. POFlickr API iOS app "POST size too large!"
    primarykey
    data
    text
    <p>I am trying to send a photo from an iOS app to Flickr using the API. I have successfully got the authorisation working and have a token ready to use. I am sending the photo data over a HTTP POST and am following the formatting guide here.</p> <p><a href="http://www.flickr.com/services/api/upload.example.html" rel="nofollow">http://www.flickr.com/services/api/upload.example.html</a></p> <p>But the response I get back from the API is... </p> <pre><code>&lt;err code="93" msg="POST size too large! Try something smaller, mmkay?" /&gt; </code></pre> <p>I have read that it may have something to do with the boundary's. I've doubled checked regarding @samrowlands comments on this post. <a href="http://www.flickr.com/groups/api/discuss/72157605534260892/" rel="nofollow">http://www.flickr.com/groups/api/discuss/72157605534260892/</a></p> <p>Any help would be great. Thanks!</p> <pre><code>UIImage *image = [UIImage imageNamed:@"photo.jpg"]; NSData *imageData = UIImageJPEGRepresentation(image, 0.9); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:@"http://api.flickr.com/services/upload/"]]; [request setHTTPMethod:@"POST"]; NSString *boundary = [NSString stringWithString:@"---------------------------7d44e178b0434"]; [request addValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary] forHTTPHeaderField: @"Content-Type:"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"api_key\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"%@\r\n", apiKey] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"auth_token\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"%@\r\n", apiToken] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"api_sig\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; NSString *uploadSig = [self md5HexDigest:[NSString stringWithFormat:@"%@api_key%@auth_token%@", apiSecret, apiKey, apiToken]]; [body appendData:[[NSString stringWithFormat:@"%@\r\n", uploadSig] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"photo\"; filename=\"photo.jpg\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Type: image/jpeg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:imageData]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPBody:body]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload