Code to download images or files
i need code to download images or files
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Farhan ShariffRank #2,004 · 725 reputationPosted Aug 25, 2014, 5:55 AM EDT
using(WebClient client = new WebClient())
{
client.DownloadFile("http://www.example.com/image.jpg", localFilename);
}
Rajendra TripathyRank #1,822 · 814 reputationPosted Aug 27, 2014, 6:14 AM EDT
string myFilename = @"c:\MyImg.jpg";
using(WebClient client = new WebClient())
{
client.DownloadFile("http://www.abc.com/car.jpg", myFilename);
}
** But before that you need to validate the availability of the image