I am using WebClient.UploadFileAsync
to upload local files to a web server and I am wondering if it is possible to get the any responses from the server after the upload is complete?
When using WebClient.UploadFile
it is possible to get a byte array containing any response. But I would like to do the upload asynchronously.
Thanks.
Subscribe to the UploadFileCompleted
event
From MSDN:
client.UploadFileCompleted += new UploadFileCompletedEventHandler (UploadFileCallback);
....
private static void UploadFileCallback(Object sender, UploadFileCompletedEventArgs e)
{
string reply = System.Text.Encoding.UTF8.GetString (e.Result);
Console.WriteLine (reply);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With