upload image using the WebRequest

srdva59

Active member
Joined
Feb 21, 2009
Messages
28
Programming Experience
Beginner
hi,
i need to upload a image to a site by using
the WebRequest so far i have this for send values:


Dim request As WebRequest = WebRequest.Create(site_name)
request.Method = "POST"

Dim byteArray As Byte() = Encoding.ASCII.GetBytes(post_value)
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)

Dim responseFromServer As String = reader.ReadToEnd()

reader.Close()
dataStream.Close()
response.Close()

MsgBox(responseFromServer)

but for send a image i have no ideia how do, i have looking for samples but
i only find for c# and i need this for vb.net

what i need change in my code to upload images to?
and other question how can i send cookies to the page?
thanks a lot for your help
:)
 
Back
Top