Uploading images to Imgur.com using C#

api, c#, http-post, imgur, uploading

Solution

looks like the site uses HTTP Post to upload images. Take a look at the HTTPWebRequest class and using it to POST to a URL: Posting data with HTTPRequest.

Problem

I just recieve my unique developer API key from Imgur and I'm aching to start cracking on this baby. First a simple test to kick things off. How can I upload an image using C#? I found this using Python: ``` #!/usr/bin/python import pycurl c = pycurl.Curl() values = [ ("key", "YOUR_API_KEY"), ("image", (c.FORM_FILE, "file.png"))] # OR: ("image", "http://example.com/example.jpg"))] # OR: ("image", "BASE64_ENCODED_STRING"))] c.setopt(c.URL, "http://imgur.com/api/upload.xml") c.setopt(c.HTTPPOST, values) c.perform() c.close() ```

Original source