Help! SmugMug Upload faultCode 5?

spacegraym3spacegraym3 Registered Users Posts: 6 Beginner grinner
I am trying to write an application that uploads a photo. I am trying to use the SmugMug upload URL with the following parameters and I get back a faultCode of 5. Does anyone know what this means? I am able to login and get a session ID which is included in the upload parameters.

URL
===

http://upload.smugmug.com/

Parameters
=======

X-Smug-Keywords = AppTest
X-Smug-ResponseType = JSON
X-Smug-Latitude = 37.44885
X-Smug-Longitude = -122.158592
X-Smug-Pretty = true
X-Smug-FileName = photo_010.jpg
X-Smug-AlbumID = 18012333
X-Smug-SessionID = <session id>
X-Smug-Version = 1.2.0

Here is the response I get back:

bytesSent = 72675
responseCode = null
response = <?xml version="1.0" encoding="utf-8"?>
<methodResponse><fault><value><struct><member><name>method</name><value><string/></value></member><member><name>faultCode</name><value><int>5</int></value></member><member><name>faultString</name><value><string>system error</string></value></member></struct></value></fault></methodResponse>

Comments

  • MSkaffariMSkaffari Registered Users Posts: 147 Major grins
    edited July 14, 2011
    I can see errors related to the AlbumID. The one you have in the post here seems OK, but for some reason the parameter doesn't get passed to our system cleanly. In fact we see a NULL instead.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 15, 2011
    Any chance that you could post some source code for the upload and/or the raw http headers on wire ?

    Thanks,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • spacegraym3spacegraym3 Registered Users Posts: 6 Beginner grinner
    edited July 25, 2011
    MSkaffari wrote: »
    I can see errors related to the AlbumID. The one you have in the post here seems OK, but for some reason the parameter doesn't get passed to our system cleanly. In fact we see a NULL instead.

    I figured out that what I was using was not setting the HTTP headers (and instead was setting POST parameters). However, I modified the code to set the headers and I am not getting an error message back but it is also not showing up posted in my target gallery.

    I am using Sencha Touch and PhoneGap on iOS which makes posting the code a bit of a challenge.

    When you say you see errors related to the AlbumID, is the error that I used the wrong ID? Thank you!
  • spacegraym3spacegraym3 Registered Users Posts: 6 Beginner grinner
    edited July 25, 2011
    devbobo wrote: »
    Any chance that you could post some source code for the upload and/or the raw http headers on wire ?

    Thanks,

    David

    Since I am using PhoneGap, it is difficult to share the code. But here is some of the most relevant parts to see if it helps.

    Now that I have the upload method setting the HTTP headers correctly via a RAW POST method, I am not getting back any errors but I am also not seeing my image on SmugMug. I have looked in the target album as well as searched my photos via the keyword to no avail.

    Any help you can provide would be fantastic. Thank you!
    function getUploadParams(sessionId, fileName, contentLength) {
        return {
            'X-Smug-Keywords': 'PMC iOS',
            'Content-Length': contentLength,
            'X-Smug-ResponseType': 'JSON',
            'X-Smug-Latitude': '37.44885', 
            'X-Smug-Longitude': '-122.158592',
            'X-Smug-Pretty': true,
            'X-Smug-FileName': fileName,
            'X-Smug-AlbumID': 18012333,
            'X-Smug-SessionID': sessionId,      // SmugMug session ID
            'X-Smug-Version': '1.2.2'   
        };
    }
    
    .....
    
        var path = imageURI.fullPath;
        var name = imageURI.name;
        
        console.log("PATH " + path + ", NAME " + name + ", SIZE: " + imageURI.size);
            
        var params = getUploadParams(sessionId, name, imageURI.size);
    
    
        var options = new FileUploadOptions();
        options.fileKey="file";
        options.fileName=name;                // Name to use when saving the file in SmugMug
        options.mimeType="image/jpeg";
        options.httpHeaders = params;       
    
        window.plugins.fileUploader.upload(
            'file://localhost/var/mobile/Applications/7B364123-4D11-4A3B-AFD1-BF285FC58B27/tmp/photo_018.jpg',  // Location of photo file on the local file system
            'http://upload.smugmug.com/',    // Upload HTTP
            function(result) {
                console.log(result);
                console.log('Upload success: ' + result.responseCode);
                console.log(result.bytesSent + ' bytes sent');
            },
            function(error) {
                console.log('Error uploading file: ' + error.code);
            },
            options    // HTTP post options / headers
        );
    
  • spacegraym3spacegraym3 Registered Users Posts: 6 Beginner grinner
    edited July 27, 2011
    bumps please
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 27, 2011
    Looking at the documentation for the component that you are using, it says it 'enables multipart/mime file uploads'. So use the upload info on the 'Multipart HTTP Post' tab here.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • spacegraym3spacegraym3 Registered Users Posts: 6 Beginner grinner
    edited July 28, 2011
    Okay. Figured it out. Thank you for the help!
Sign In or Register to comment.