Pause/Resume Upload in C#

前端 未结 4 1799
我在风中等你
我在风中等你 2021-01-14 07:00

I\'m looking for a way to pause or resume an upload process via C#\'s WebClient.

pseudocode:

WebClient Client = new WebClient();
Client.UploadFileAsync(new         


        
4条回答
  •  走了就别回头了
    2021-01-14 07:14

    As stated by Jon Skeet, this is not available in the Webclient not HttpWebRequest classes.

    However, if you have control of the server, that receives the upload; perhaps you could upload small chunks of the file using WebClient, and have the server assemble the chunks when all has been received. Then it would be somewhat easier for you to make a Pause/resume functionality.

    If you do not have control of the server, you will need to use an API that gives you mere control, and subsequently gives you more stuff to worry about. And even then, the server might give you a time-out if you pause for too long.

提交回复
热议问题