Uploading a Photo

yanashyanash Registered Users Posts: 2 Beginner grinner
Hi! I get problems uploading a photo to my album.

I login fine and get session ID as follows:
p.Add("method","smugmug.login.withPassword");
p.Add("EmailAddress", "xxx@xxx.com");
p.Add("Password","xxx");
p.Add("APIKey",API_KEY);
byte[] response1 = webClient.UploadValues("https://api.smugmug.com/services/api/xmlrpc/1.2.2/", p);

If I get Album Info the results are fine.

However when I try to upload a photo something goes wrong.

I try both ways, but loading from local drive is preferable:

p.Add("method", "smugmug.images.uploadFromURL");
p.Add("SessionID", Session);
p.Add("AlbumID", "xxx");
p.Add("URL", "http://xxx.com/xxx.jpg");
byte[] response2 = webClient.UploadValues("https://api.smugmug.com/services/api/xmlrpc/1.2.2/", p);
The server throws Internal Error 500, the image is actually added to the gallery.

webClient.Headers.Add("X-Smug-AlbumID", "xxx");
webClient.Headers.Add("X-Smug-SessionID", Session);
webClient.Headers.Add("X-Smug-Version", "1.3.0");
webClient.Headers.Add("X-Smug-FileName", FileName);
webClient.UploadFileAsync(new System.Uri("http://upload.smugmug.com/" + FileName), FileName);
No errors happen, however the image is not added to the Gallery and the responsse comes empty.

What am I doing wrong?
Sign In or Register to comment.