Tell me more ×
SmugMug Stack Exchange is a question and answer site for SmugMug developers and end users. It's 100% free, no registration required.

I am working on an app that will upload images to my smugmug account. I am using phpSmug 3.4 and the following code:

   require_once( "phpSmug.php" );



        try {
            //assign Variable to smugmug
            $f = new phpSmug("APIKey=*****************", "AppName=Test/1.0");
            // Login Anonymously
            $f->login();    




                $f->images_upload("AlbumID=2282300", "File=TestPic.jpg");



        }
        catch ( Exception $e ) {
            echo "{$e->getMessage()} (Error Code: {$e->getCode()})";
        }

?>

but I get back:

SmugMug API Error for method image_upload: missing required parameter (Error Code: 22)

Do I have to use Oauth to upload, or can it be done anonymously? Is my syntax wrong?

share|improve this question
my fault, was not working locally, works on server – Jjames Jun 3 '12 at 16:48

2 Answers

up vote 3 down vote accepted

As the author of phpSmug, I can tell you your problem and solution is simple: you can't upload images to Smugmug anonymously. You need to login using one of the identifying authentication methods supported by SmugMug and implemented in phpSmug.

share|improve this answer

Your PHP syntax looks fine! Although it can be condensed a lot. I'm assuming you are referring to smugmug.images.uploadFromURL (images_uploadFromURL in phpSmug)

You will have to log into SmugMug (through phpSmug) to:

  • Upload images
  • Create/rename/move/delete stuff
  • Add comments
  • And much more...

Which of the requests that can be used anonymously is not obvious in the SmugMug API docs, but whatever takes an OAuth argument probably cannot. OAuth is the way to go. The user/password approach will work for a quick test, but it should never, ever be put into production code. It is a major security risk.

extra tip: $f can be changed to $smugmug (or whatever you want), just do it everywhere.

share|improve this answer
Thank you for the tips as well. – Jjames Jun 4 '12 at 13:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.