The real napster
The real napster

Reputation: 2324

How do I save an Image from an url?

How do I take an image from an url and save it locally?

http://someurl.com/imagename.jpg -> c:\apppath\imgfolder

ASP.NET C#

I am not very good with IO stuff, hope someone can help me out :)

Upvotes: 0

Views: 874

Answers (1)

Eoin Campbell
Eoin Campbell

Reputation: 44308

Try this.

System.Net.WebClient wc = new System.Net.WebClient();

wc.DownloadFile("http://www.domin.com/picture.jpg", @"C:\Temp\picture.jpg");

Since you've tagged this with ASP.NET, it's worth pointing out that if you put this code in your ASP.NET Website/Web Application, you'll need to make sure the the Identity/Account that your application is running as, has permission to write the file to the file system.

Upvotes: 6

Related Questions