How do I programmatically save an image from a URL?

后端 未结 4 601
星月不相逢
星月不相逢 2020-11-30 22:05

How do I programmatically save an image from a URL? I am using C# and need to be able grab images from a URL and store them locally. ...and no, I am not stealing :)

4条回答
  •  鱼传尺愫
    2020-11-30 23:11

    My solution is pre save the image to de disk and then usa as a normal saved image:

    remoteFile = "http://xxx.yyy.com/image1.png"; localFile = "c:\myimage.png";

    WebClient webClient = new WebClient(); webClient.DownloadFile(remoteFile, localFile);

提交回复
热议问题