Uploading an image using C# and WebRequest?
问题 Here is the working code in Python (using cURL): #!/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() Here's what I have in C#: public void UploadImage() { //I think this line is doing something wrong. //byte[] x = File