1

ユーザーが有効な画像の URL を入力する aspx ページがあります (例: https://stackoverflow.com/Content/Img/stackoverflow-logo-250.png )。この画像をサーバーにアップロードするプログラムが必要です。これどうやってするの ?

4

1 に答える 1

7
System.Net.WebClient webClient = new WebClient();

webClient.DownloadFile(@"http://stackoverflow.com/Content/Img/stackoverflow-logo-250.png",
@"c:\path\localfile.png");

Server.MapPathを使用して、相対パスまたは仮想パスに対応するサーバー上の物理ディレクトリを取得できます。たとえば、Server.MapPath("~/Images")

于 2008-11-02T05:02:04.857 に答える