本文介紹了在 C# 中暫停/恢復上傳的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我正在尋找一種通過 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模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!