Download the file from any URL and save it to my computer using ASP.NET.

Case: I need to submit my application URL from anywhere on the Internet. At the other end of the URL there will be a file of some kind. Image / video / document, and I need to save this item to my server automatically without the Save As dialog box.

This must be done in ASP.NET.

I'm having problems with how to actually capture this file using asp.net after submitting the url ... Any help would be great!

Thank you all

+3
source share
3 answers

webclient httpwebrequest. , , , .

WebClient wc = new WebClient();

wc.DownloadFile(downloadURL.Text, savePath.Text);
+3

System.Net.WebClient. DownloadFile .

using (WebClient wc = new WebClient())
{
    wc.DownloadFile(myUrl, myLocalFileName);
}

, , -, .

+7

Source: https://habr.com/ru/post/1724513/


All Articles