Help with FtpWebRequest (UploadFile status/progress)

D

Dan

Hi,
I have implemented a code to send file to our server using FTP, and it is
working.
But the issue is I have no idea when the process will complete sending.
Is there any way to know how much has been sent to the server or any event I
can trap when the process ends.
Below is the sample code I am using.

Dim reqObj As FtpWebRequest =
WebRequest.Create("ftp://SomeIP/FileName.txt"))

reqObj.Credentials = New NetworkCredential("something", "something")
reqObj.Method = WebRequestMethods.Ftp.UploadFile

Dim streamObj As IO.FileStream = System.IO.File.OpenRead(FileName)
Dim buffer(streamObj.Length) As Byte

streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = Nothing
reqObj.Proxy = Nothing

reqObj.GetRequestStream().Write(buffer, 0, buffer.Length)
reqObj = Nothing

Please guide with an example or link.

Thanks in advance.
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top