Options

System error 5 with proven Objective-C code when uploading a photo

sundialsoftsundialsoft Registered Users Posts: 4 Beginner grinner
My iphone app PhotoKing has been live for many months. When testing some iOS 6 changes unrelated to SmugMug code photo uploads are failing:-
code = 5;
message = "system error";
method = "smugmug.images.upload";
stat = fail;
I can create an album & view photos so everything else works & I use very similar code for PhotoBucket and Tumblr that also still works for photo upload. I reinstalled the app & logged on again just to be sure.

As my code has not been changed I would like to ask if there is anything different at the server end that's not obvious to me? Any parameter changes etc?
I have been back through the api docs & ran lots of debugging on my app to no avail.
I use http://upload.smugmug.com and the Oauth multi-part code I use has been bullet proof for many months however I can't remember uploading to SmugMug for quite a while.

Just to confirm this is the latest API, tested on multiple devices. Oauth code works for several other sites inc Photobucket.
My account uploads fine via camera awesome. The original code from Apple appstore also fails now so definitely not something I've done to the code.

As this issue is holding up an iOS6/iPhone 5 update for my photo app on the app store I will wait one week for any feedback then if I can't fix it will have to remove SmugMug from the app & replace it with one of the other photo sharing services. It was an easy integration to do but it's not mainstream so I will have to pull it if there's no support. Fingers crossed someone replies.

update: I pointed a port sniffer at Camera Awesome. It's using an http PUT with OAuth. I have been using a multi-part http POST. Maybe analysing the working PUT data will help.

Regards

Ian
sundialSoft

Comments

  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited October 10, 2012
    I hope someone chimes in. I think I've noticed a problem with the same method, but haven't had time to debug it.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • Options
    sundialsoftsundialsoft Registered Users Posts: 4 Beginner grinner
    edited October 19, 2012
    Looks like SMugMug support is non-existent. I will give an alternative method a try & if that does not work will have to rip it out of my app & put in something else. Will update Monday when I will get back to this.
  • Options
    rainforest1155rainforest1155 Registered Users Posts: 4,566 Major grins
    edited October 19, 2012
    Ian,
    Sorry you haven't received another reply yet. While I'm no API expert, it might be helpful if you could share details, like the full request you send and what you receive back as the response.
    Sebastian
    SmugMug Support Hero
  • Options
    sundialsoftsundialsoft Registered Users Posts: 4 Beginner grinner
    edited October 23, 2012
    Additional info
    Simon, the error coming back is as previously stated:-
    code = 5;
    message = "system error";
    method = "smugmug.images.upload";
    stat = fail;
    My post params are:-
    AlbumID=22591969&Caption=Test&FileName=photoKing&Pretty=true&ResponseType=JSON&SessionID=47f38ddf51f583166b410bcb6e6bf011&Version=1.3.0&oauth_consumer_key=<MYKEYHERE>&oauth_nonce=117CB9AE-4EF0-49FD-849D-BE10E0714614&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1350994669&oauth_token=<MYTOKENHERE>&oauth_version=1.0

    The code I use (which then used separate OAUTH code to do some work) is:-

    NSString *aPath = @&quot;";// because of special end point no extra path needed http://upload.smugmug.com/
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    appDelegate.photoUploadMode = @SMUGMUG;
    NSMutableDictionary *fullParams = [[NSMutableDictionary alloc] initWithCapacity:20];
    [fullParams setObject:@photoKing forKey:@FileName];
    if(smugMugStep == addPhotoAfterNewAlbum)
    {
    [fullParams setObject:albumID forKey:@AlbumID];// id set when album create returned v
    }
    else {
    NSString *ID = [NSString stringWithFormat:@%d, photoalbumIDs objectAtIndex:selectedIndex] intValue;
    NSLog(@album %@",ID);
    [fullParams setObject:ID forKey:@AlbumID];//
    }
    [fullParams setObject:@1.3.0 forKey:@Version];
    [fullParams setObject:message forKey:@Caption];
    [fullParams setObject:@JSON forKey:@ResponseType];
    [fullParams setObject:@true forKey:@Pretty];
    [fullParams setObject:self.smugMugSessionID forKey:@SessionID];

    aRequest = [[OAuthASIFormDataRequest alloc] initWithParams:fullParams path:aPath];
    [aRequest setDelegate:self];
    [aRequest setRequestMethod:@POST];//POST
    [aRequest setPostFormat: ASIMultipartFormDataPostFormat];
    [aRequest setDidFinishSelector:@selector(imageUploadRequestSucceeded:)];
    [aRequest setDidFailSelector:@selector(imageUploadRequestFailed:)];
    [aRequest setUploadProgressDelegate:self.sendBar];
    // Upload an image
    [aRequest addData:media withFileName:@photoUpload andContentType:@image/jpeg forKey:@userfile];
    [aRequest startAsynchronous];

    Note that this code worked fine dozens of times & stopped working in the past few months.
Sign In or Register to comment.