You want to use the WebRequest class, POST the data. Not sure how
you'll encode the key and image fields though - might take a bit of
trial and error.

On Mon, Jan 11, 2010 at 3:09 PM, papuccino1 <[email protected]> wrote:
> I'm trying to make an Open Source application in WPF using C# for
> uploading images to Imgur.com
>
> I've recieved my API key and I'm kind of lost because there is no C#
> example to learn from. Also, squat documentation.
>
> Here's the working Python code given from the API website:
>
> #!/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";))]
>
> c.setopt(c.URL, "http://imgur.com/api/upload.xml";)
> c.setopt(c.HTTPPOST, values)
>
> c.perform()
> c.close()
>
> I have absolutely no idea how to proceed. I downloaded the .NET
> implementation which are three .dll files and tried adding them to a
> project but I recieve an error that they are not appropiate COM
> Components. Who knows what the heck that means. :P
>
> Can someone give me a little example on how to accomplish that Python
> code in C#? I'm guessing using HTTPWebRequest, but there are no
> examples that use an API key anywhere online.
>
> Thanks,
> Serg
>

Reply via email to