我正在使用UploadFileAsync上传文件。
服务器开始上传后,就会发送对请求的响应。
但是,文件上传完成后,您会收到响应。 (上传完成后将调用UploadFileCompleted。)
我可以在上传过程中处理服务器的响应吗?
webClient.UploadFileCompleted += UploadFileCompletedCallback;
webClient.UploadProgressChanged += UploadProgressCallback;
webClient.UploadFileAsync("http://mydomain.test/upload.jsp", "C:\test.jpg");
private void UploadFileCompletedCallback(object sender, UploadFileCompletedEventArgs e)
{
Console.WriteLine("UploadFileCompletedCallback");
}
private void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
Console.WriteLine("UploadProgressCallback : " + e.BytesSent + " / " + e.TotalBytesToSend);
}