我正在寻找一种通过 C# 的 WebClient 暂停或恢复上传过程的方法.
I'm looking for a way to pause or resume an upload process via C#'s WebClient.
伪代码:
WebClient Client = new WebClient();
Client.UploadFileAsync(new Uri("http://mysite.com/receiver.php"), "POST", "C:MyFile.jpg");
也许像..
Client.Pause();
有什么想法吗?
WebClient
没有这种功能 - 即使是稍微低级的 HttpWebRequest
也没有不,据我所知.您将需要使用一个 HTTP 库,它可以让您在事情发生时更好地控制确切(当然,这也将涉及更多代码).WebClient
的重点是提供一个非常简单的 API 以在非常简单的情况下使用.
WebClient
doesn't have this kind of functionality - even the slightly-lower-level HttpWebRequest
doesn't, as far as I'm aware. You'll need to use an HTTP library which gives you more control over exactly when things happen (which will no doubt involve more code as well, of course). The point of WebClient
is to provide a very simple API to use in very simple situations.
这篇关于在 C# 中暂停/恢复上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!