save web images to the server upload pictures function often contact, will be saved to the server from the local picture. If a web site only provides the picture, can also save the picture to the server?


To create a GetImage.aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetImage.aspx.cs" Inherits="KeleyiTestWeb.KImage.GetImage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
<title> save web images to the server -KWS</title>
<form id="form1" runat="server">
To get the picture.: <asp:TextBox runat="server" ID="tbPicUrl" Text="" Width="300" />
<asp:Button Text="Save the "runat=" server "ID=" btnSave "onclick=" btnSave_Click "/> <br /> to succeed in saving to a server at the same time will be shown in the following
<br /><asp:Literal runat="server" ID="ltlTips" />
<br /><asp:Image runat="server" ID="imgDownload" />
<div>This example please refer to: <a href="" target="_blank"> ;/a> </div>

Idea is to click the "save" button, according to enter the site, use the KeleyiImgDownloader class to get pictures, save to the server specified directory, and then displayed on the page. Class KeleyiImgDownloader and the integrity of the source code to download here:



Posted by Opie at December 17, 2013 - 9:13 PM