Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# download file from url

using System;
using System.Net;
using System.IO;

class FileDownloader
{
    static void Main()
    {
        
        string path = "http://www.educative.io/cdn-cgi/image/f=auto,fit=contain,w=2400/api/edpresso/shot/5224207262154752/image/5022165490991104.png";
        using(WebClient client = new WebClient())
        {
          client.DownloadFile(path,"image.png");
        }

        if(File.Exists("image.png"))
        {
          Console.WriteLine("File Downloaded Successfully");
        } 
        else
        {
          Console.WriteLine("Not able to download the file.");
        }        
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #download #file #url
ADD COMMENT
Topic
Name
9+9 =