Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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


i want http://imgdb.kilho.net/upload.php upload my photo .. plz help [^]
Posted

1 solution

Please stop posting the same question. Rather than asking people to convert reams of variations of file posting code from ancient languages, just learn how to submit a file via POST in your target language and use the code accordingly.

.net - How to post a file via HTTP post in vb.net - Stack Overflow[^]

WebClient.UploadFile Method (String, String) (System.Net)[^]

However this still isn't going to help with the fact that you don't have access to their URL. You'll need to contact whoever supports the site for help with that. It could be you need to send specific headers in the request.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900