Public Function InvenImageUpload(ByVal path As String) As String Dim ImageBinary() As Byte ImageBinary = IO.File.ReadAllBytes(Filepath.Text) Dim Header1 As String, Header2 As String wbody = TextBox1.Text Header1 = System.Text.UnicodeEncoding.GetChars(Split(wBody, "wBinary")(0)) Header2 = System.Text.UnicodeEncoding.GetChars(Split(wBody, "wBinary")(1)) Dim BHeader1() As Byte, BHeader2() As Byte, Buffer() As Byte BHeader1 = System.Text.Encoding.UTF8.GetBytes(Header1) BHeader2 = System.Text.Encoding.UTF8.GetBytes(Header2) Dim DS As New MemoryStream DS.Write(BHeader1, 0, BHeader1.Length) DS.Write(ImageBinary, 0, ImageBinary.Length) DS.Write(BHeader2, 0, BHeader2.Length) DS.Position = 0 ReDim Buffer(DS.Length) DS.Read(Buffer, 0, Buffer.Length) : DS.Close() With winhttp .Open("POST", "http://imgdb.kilho.net/upload.php") .SetRequestHeader("Content-Type", "multipart/form-data; boundary=----------1877296668268") .SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0") .SetRequestHeader("Host", "http://image.kilho.net/") .SetRequestHeader("Content-Length", UBound(Buffer)) .Send(Buffer) .WaitForResponse() : Application.DoEvents() ' Headers = .GetAllResponseHeaders MsgBox(.ResponseText) End With End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)