Download Files by web link C#

Asked

Viewed 378 times

0

would like to deploy on a system I’m making an option to download the files over the web, by pre-defined cloud links that I have.

However, I am not managing to implement this. Can you help me??

1 answer

5


Using the method Webclient it is possible to do this in a simple way. Follow an example:

using (var client = new WebClient())
 {
         client.DownloadFile("http://exemplo.com/arquivo/foto/foto1.jpg", "foto1.jpg");
 }  
  • in this way I direct the folder in which the file will be saved?

  • 1

    In the parameter that defines the file name the destination path can be passed: @"c:\foto.jpg"

  • worked buddy, thank you very much

Browser other questions tagged

You are not signed in. Login or sign up in order to post.