Quantcast
Viewing all articles
Browse latest Browse all 18858

File Upload Progress

Hi all,

I am working on an FTP file upload in our application and I need to be able to calculate the upload progress to update a progress bar. The upload is already working. I just need to be able to update the progress bar. This is my code.

using (StreamReader sourceStream = new StreamReader(filePath))
                {
                    byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());

                    using (Stream uploadStream = request.GetRequestStream())
                    {
                        uploadStream.Write(fileContents, 0, fileContents.Length);

                        //Update Progress bar here

                    }
                }

Any ideas how to do it?

Thanks in advance.


Viewing all articles
Browse latest Browse all 18858

Trending Articles