Here's the snippet:
Function Encode(ByVal dec As String) As String
Dim bt() As Byte
ReDim bt(dec.Length)
bt = System.Text.Encoding.ASCII.GetBytes(dec)
Dim enc As String
enc = System.Convert.ToBase64String(bt)
Return enc
End Function
I'm trying to make an program that sends an image for upload to a website. Here's the code in Python, I'm trying to port it to C# but it's a bit confusing because I don't know any 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()
Am I even supposed to be transforming the image.png file to a Base64 string? Please help.