private void UploadSelectedImages(ListBox.ObjectCollection objectCollection)
{
foreach (var photo in objectCollection)
{
using (var w = new WebClient())
{
var values = new NameValueCollection
{
{ "key", "<my api here>" },
{ "image", Convert.ToBase64String(File.ReadAllBytes(photo.ToString())) }
};
XDocument response = new XDocument(w.UploadValues("http://imgur.com/api/upload.xml", values));
string name = photo.ToString();
string smallThumbnail = (string)response.Root.Element("small_thumbnail");
string actualImage = (string)response.Root.Element("original_image");
UploadedImage image = new UploadedImage(name, smallThumbnail, actualImage);
uploadedImages.Add(image);
}
}
foreach (var uploadedImage in uploadedImages)
{
MessageBox.Show(uploadedImage.ActualImage);
}
}
I receive this error when creating the XDocument object. Any ideas on what could be wrong?
I guess my question is [b]How can I convert a byte[] response to an XML document?
This post has been edited by Sergio Tapia: 10 August 2010 - 08:18 AM

New Topic/Question
Reply



MultiQuote



|