我正在寻找一种通过 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# 中暂停/恢复上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
车牌检测有哪些好的算法?What are good algorithms for vehicle license plate detection?(车牌检测有哪些好的算法?)
Unity中图像的onClick事件onClick event for Image in Unity(Unity中图像的onClick事件)
运行总 C#Running Total C#(运行总 C#)
单击带有 JAvascript.ASP.NET C# 的超链接时删除目录Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(单击带有 JAvascript.ASP.NET C# 的超链接时删除目录)
asp.net listview 在单击时突出显示行asp.net listview highlight row on click(asp.net listview 在单击时突出显示行)
从函数调用按钮 OnClickCalling A Button OnClick from a function(从函数调用按钮 OnClick)