Hello, I'm currently working on a little personal project for myself. Nothing big however I am kind of a noob as far as VB.NET goes so any help would be greatly appreciated.

I am trying to upload an image to my website using it's API. I know for a fact that I have to convert the image to a Base64 String and then upload using the "POST" method with HttpWebRequest. So knowing this here is the code I have so far for saving the image taken from a screenshot and being converted to Base64. And then trying to "POST" the image to my API.

Any help would be greatly appreciated!

sd.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
        Dim base64string As String = Convert.ToBase64String(ms.ToArray())

        'Begin upload process
        Const UploadURL = "http://imagereplica.com/api.php"
        Dim request As HttpWebRequest = HttpWebRequest.Create(UploadURL)
        request.AllowAutoRedirect = False

        request.ContentType = "application/x-www-form-urlencoded"
        Dim PostData As String = "upload=" & base64string
        request.Method = "POST"
        request.ContentLength = PostData.Length
        Dim requestStream As Stream = request.GetRequestStream()
        Dim postBytes As Byte() = Encoding.UTF8.GetBytes(PostData)
        requestStream.Write(postBytes, 0, postBytes.Length)