Головна‎ > ‎C#‎ > ‎Додатково‎ > ‎

Завантажити файл

HTTP

using (var client = new WebClient()) { 

     client.DownloadFile("http://example.com/file/song/1.mp4", "1.mp4"); 

}



FTP

using (WebClient client = new WebClient())
{
    client.Credentials = new NetworkCredential(ftpUsername, ftpPassword);
    client.UploadFile("ftp://ftpserver.com/target.zip", WebRequestMethods.Ftp.UploadFile, localFilePath);

}