如何从网址下载图片 [英] How download image from url
问题描述
我有一个网址:-http://resources.printofast.com/media/bdccb931-1599-4eba-817d-6b3968ab90ee.jpg
我想使用asp.net原样下载此图片。
请让我知道因为我无法做到。
非常感谢
我尝试过:
1. string url = @http://resources.printofast.com/media/bdccb931-1599-4eba-817d-6b3968ab90ee.jpg ;
WebClient客户端=新的WebClient();
client.DownloadFileCompleted + = new AsyncCompletedEventHandler(client_DownloadFileCompleted);
client.DownloadFileAsync(new Uri(url),@c:\\ \\ temp\image35.png);
试试这个
string url = http:// resources .printofast.com /媒体/ bdccb931-1599-4eba-817d-6b3968ab90ee.jpg跨度>;
WebClient webClient = new WebClient();
string path = Server.MapPath( 图像); // 在根目录中创建名为Images的文件夹
string fileName = Path.GetFileName(url);
webClient.DownloadFile(url,path + \\ + fileName);
Hi ,
I have an url :-http://resources.printofast.com/media/bdccb931-1599-4eba-817d-6b3968ab90ee.jpg
I want to download this image using asp.net as it is .
Please let me know as i am unable to do it .
Many thanks
What I have tried:
1. string url = @"http://resources.printofast.com/media/bdccb931-1599-4eba-817d-6b3968ab90ee.jpg";
WebClient client = new WebClient();
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
client.DownloadFileAsync(new Uri(url), @"c:\temp\image35.png");
try this
string url = "http://resources.printofast.com/media/bdccb931-1599-4eba-817d-6b3968ab90ee.jpg"; WebClient webClient = new WebClient(); string path = Server.MapPath("Images") ; // Create a folder named 'Images' in your root directory string fileName = Path.GetFileName(url); webClient.DownloadFile(url, path + "\\" + fileName);
这篇关于如何从网址下载图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!