coolerfarmer

Untitled

Jul 11th, 2014
5,572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. public static string UploadImageToGoogle(string username, string password)
  2. {
  3. const string image = "C:\\Popular\\1.jpg";
  4. if (!System.IO.File.Exists(image))
  5. return "Error! Image not found";
  6.  
  7. PicasaService service = new PicasaService("BloggerPoster");
  8. service.setUserCredentials(username, password);
  9.  
  10. Uri postUri = new Uri(PicasaQuery.CreatePicasaUri(username));
  11.  
  12. FileInfo fileInfo = new System.IO.FileInfo(image);
  13. FileStream fileStream = fileInfo.OpenRead();
  14.  
  15. PicasaEntry entry = (PicasaEntry)service.Insert(postUri, fileStream, "image/jpg", image);
  16. fileStream.Close();
  17.  
  18. Photo ac = new Photo();
  19. string contentUrl = (string) entry.Media.Content.Attributes["url"];
  20.  
  21. return contentUrl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment