在C#中暂停/恢复上传 [英] Pause/Resume Upload in C#

查看:157
本文介绍了在C#中暂停/恢复上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来暂停或继续通过C#的Web客户端的上传过程

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();

任何想法?

推荐答案

Web客户端没有按'吨有这种功能 - 即使是略较低级别的的HttpWebRequest 不,据我所知。你需要使用一个HTTP库,为您提供更多的控制权的究竟的事情时有发生(这无疑会涉及到更多的代码为好,当然)。 Web客户端的一点是要提供一个非常简单的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#中暂停/恢复上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆