Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to download file from url using c#

using (var client = new WebClient())
{
    client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg");
}
Comment

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.");
        }        
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get unix timespan 
Csharp :: Retrieve url path 
Csharp :: unity player look at mouse 
Csharp :: c# generate random date 
Csharp :: rigidbody2d unfreeze position 
Csharp :: C# get all child classes of a class 
Csharp :: unity c# on trigger enter with specific gameobject 
Csharp :: c# loop datatable rows 
Csharp :: initialise icollection c# 
Csharp :: c# wait seconds 
Csharp :: 3(x-4)-2(3x+4)=4(3-x)+5x+4 
Csharp :: unity reload current scene 
Csharp :: c# cast string to double 
Csharp :: asp core asp for not working 
Csharp :: c# request.url 
Csharp :: byte array to hex c# 
Csharp :: create asset menu unity 
Csharp :: how to do cmd command c# 
Csharp :: how to reference text mesh pro unity 
Csharp :: string to date vb 
Csharp :: console.writeline 
Csharp :: how to get executable path in wpf 
Csharp :: linq select count group by c# 
Csharp :: c# array last element 
Csharp :: link nuttom in c# 
Csharp :: C# how to remove an image in a folder 
Csharp :: c# check if is float 
Csharp :: remove focus from button unity 
Csharp :: orderbyascending c# 
Csharp :: struct constructor c# 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =