ネット上にある画像ファイルをダウンロードして保存するサンプル

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string jpgFileName = @"C:\tmp\test2.jpg";
            WebClient client = new WebClient();
            byte[] data = client.DownloadData("http://hogehogehogehoge/hogefuga.jpg");
            File.WriteAllBytes(jpgFileName, data);
        }
    }

}

とりあえずメモメモ

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です