Article: Uploading File Asynchronously

Index

Uploading File Asynchronously

You can upload a file asynchronously using the HTTP class.

Example

HTTP http = new HTTP();

http.Hostname = “HostnameAddress”;

http.FileUploadCompleted += new HTTP.UploadFileCompletedDelegate(http_FileUploadCompleted);

http.FileUploadProgressChanged += new HTTP.UploadFileProgressChangedDelegate(http_FileUploadProgressChanged);
http.UploadFileAsync(“C:\FileToUpload.txt”);
 
private void http_FileUploadProgressChanged(object sender, System.Net.UploadProgressChangedEventArgs e)
{
    MessageBox.Show(e.BytesReceived.ToString());
}

private void http_FileUploadCompleted(object sender, System.Net.UploadFileCompletedEventArgs e)
{
    MessageBox.Show(“File Uploaded Completed”);
}

Related Articles

Main Categories