public void uploadStreamWithProgress_ProgressChanged(object sender, StreamWithProgress.ProgressChangedEventArgs e) { if (e.Length != 0) this.ProgressValue = (int)(e.BytesRead * 100 / e.Length); }
public void StartUpload() { try { FileInfo fileInfo = new FileInfo(this.FilePath); if (fileInfo.Exists) { // open input stream using (FileStream stream = new FileStream(this.FilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { using (StreamWithProgress uploadStreamWithProgress = new StreamWithProgress(stream)) { uploadStreamWithProgress.ProgressChanged += uploadStreamWithProgress_ProgressChanged; this.Client.UploadFile(fileInfo.Name, fileInfo.Length, 0, uploadStreamWithProgress); } } } } catch { } }