How to download image programmatically from remote location using c#
Use this code to download image from remote location using c#
MemoryStream stream = new MemoryStream(); byte[] imagetoUpload; string imageName = string.Empty; string imgUrl = string.Empty; System.Net.WebClient wc = new System.Net.WebClient(); imgUrl = "http://www.google.co.in/logos/boombah_chamki-hp.gif "; imagetoUpload = wc.DownloadData(imgUrl); imageName = imgUrl.Substring(imgUrl.LastIndexOf("/") + 1); stream.Write(imagetoUpload, 0, imagetoUpload.Length); Bitmap bmp = new Bitmap(stream); bmp.Save(@"D:\" + imageName);
Namespace required:
using System.IO;
using System.Drawing;
Thanks,
Abhay
Comments
Post a Comment