Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string UploadImageToGoogle(string username, string password)
- {
- const string image = "C:\\Popular\\1.jpg";
- if (!System.IO.File.Exists(image))
- return "Error! Image not found";
- PicasaService service = new PicasaService("BloggerPoster");
- service.setUserCredentials(username, password);
- Uri postUri = new Uri(PicasaQuery.CreatePicasaUri(username));
- FileInfo fileInfo = new System.IO.FileInfo(image);
- FileStream fileStream = fileInfo.OpenRead();
- PicasaEntry entry = (PicasaEntry)service.Insert(postUri, fileStream, "image/jpg", image);
- fileStream.Close();
- Photo ac = new Photo();
- string contentUrl = (string) entry.Media.Content.Attributes["url"];
- return contentUrl;
- }
Advertisement
Add Comment
Please, Sign In to add comment