Hi, I am building a client program that uploads a file to a server via
a HttpWebRequest PUT.

Basically i would like to throttle this - I want to limit the upload
speed on the client side. I have looked around and have not been able
to find the answer. If i need to use a different method of uploading
then so be it, but here is the code i am using which is working fine:

'create local file stream
Dim rdr As New FileStream(fileToUpload, FileMode.Open)

Dim webReq As HttpWebRequest = DirectCast(WebRequest.Create
(uploadLocation), HttpWebRequest)
webReq.Method = "PUT"
webReq.ContentLength = rdr.Length
webReq.AllowWriteStreamBuffering = True

Dim reqStream As Stream = webReq.GetRequestStream()
Dim inData As Byte() = New Byte(rdr.Length - 1) {}

' Get data from upload file to inData
Dim bytesRead As Integer = rdr.Read(inData, 0, rdr.Length)

' put data into request stream
reqStream.Write(inData, 0, rdr.Length)

rdr.Close()



If anyone happens to know of anything, even if it points me in the
right direction, that would be great.
Thanks heaps.
John

Reply via email to