Copy image file from web url to local folder?

后端 未结 4 1260
刺人心
刺人心 2021-02-02 18:01

I have a web URL for the image. For example \"http://testsite.com/web/abc.jpg\". I want copy that URL in my local folder in \"c:\\images\\\"; and also when I copy that file into

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 18:59

    You could use a WebClient:

    using (WebClient wc = new WebClient())
        wc.DownloadFile("http://testsite.com/web/abc.jpg", @"c:\images\xyz.jpg");
    

    This assumes you actually have write rights to the C:\images folder.

提交回复
热议问题