using (var w = new WebClient())
{
var values = new NameValueCollection
{
{"image", Convert.ToBase64String(File.ReadAllBytes(xOut))}
};
w.Headers.Add("Authorization", "Client-ID xxxxxxxxxxxxx");
byte[] response = w.UploadValues("https://api.imgur.com/3/upload.xml", values);
}
replace xxxxxxxxx with your client id, given to you by imgur (must register your app first, even to upload anonymously). the biggest problem for me was I could not figure out how to send that "header" value since none of the code samples I found before had this. well, now we know. my program is now uploading quickly and getting a response (byte[]). process that however you may need, I just parse it for the link. there may be easier, cleaner ways (would love to hear it) but this works :-)
Thank you for that code! I have never used an API before so I was struggling with being able to upload to Imgur.
After spending some time figuring it out I have converted your code to Visual Basic so that I can use it in my program but I am struggling with how to process/parse the response. When I use .ToString or Convert.ToBase64String or BitConverter.ToString I get a seemingly random set of characters. Would you be able to show me your method of converting it to a link?
If you do not know Visual Basic I would be happy to see it in C# and try and convert it again.
Thank you for your time