asp.net ͼƬÉÏ´«
protected void Button1_Click(object sender, EventArgs e)
{
string fullName = this.File1.PostedFile.FileName;//»ñÈ¡ÉÏ´«ÎļþµÄȫ·¾¶
string size = this.File1.PostedFile.ContentLength.ToString();//»ñÈ¡ÎļþÉÏ´«µÄ´óС
string fileName = fullName.Substring(fullName.LastIndexOf("\\")+1); //»ñÈ¡ÉÏ´«ÎļþµÄÎļþÃû
string type = fullName.Substring(fullName.LastIndexOf(".")+1);//»ñÈ¡ÎļþÉÏ´«¸ñʽ
if (type == "jpg" || type == "bmp" || type == "gif" || type == "ico")
{
this.File1.PostedFile.SaveAs(Server.MapPath("upload") + "\\" + fileName);//½«Í¼Æ¬ÉÏ´«µ½¸ÃÏîÄ¿ÖеÄuploadÎļþ¼ÐÏÂ
this.Imp.Visible = true;
this.Imp.ImageUrl = "upload/" + fileName;//ÏÔʾͼƬ
}
else
{
Response.Write("<script language='javascript'>alert('ÄãÉÏ´«µÄͼƬ¸ñʽÓдíÎó£¡')</script>");
}
}
Ïà¹ØÎĵµ£º
Ò»¡¢¼òµ¥½éÉÜ
using System.Xml;
//³õʼ»¯Ò»¸öxmlʵÀý
XmlDocument xml=new XmlDocument();
//µ¼ÈëÖ¸¶¨xmlÎļþ
xml.Load(path);
xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
//Ö¸¶¨Ò»¸ö½Úµã
XmlNode root=xml.SelectSingleNode("/root" ......
1.ÎļþÏÂÔØ
HTTP ÎļþÏÂÔØÖ÷ÒªÓÐÁ½ÖÖ·½Ê½£º
URL·½Ê½Ö±½ÓÏÂÔØ£¬ÓŵãÊÇ£ºÕ¼Ó÷þÎñÆ÷×ÊÔ´ÉÙ£¬Ëٶȿ죻ȱµãÊÇ£º ²»ÄÜ׼ȷ¼ÆÁ¿ÏÂÔØ´ÎÊý£¬ÎÞ·¨·ÀÖ¹µÁÁ´£¬±£´æÔÚÊý¾Ý¿âÖеÄÎļþÎÞ·¨ÏÂÔØ£¬³£¼û¸ñʽµÄÎļþÈç.html Ö±½ÓÔÚä¯ÀÀÆ÷Öдò¿ª£¬²»ÄÜÖ±½ÓÏÂÔØ¡£
¶þ½øÖÆÊý¾ÝÁ÷Êä³ö·½Ê½£¬ÓŵãÊÇ£º×¼È·¼ÆÁ¿ÏÂÔØ´ÎÊý¡¢ÄÜ·ÀµÁÁ´¡¢ËùÓÐÎļ ......
ʹÓà ASP.NET °´Å¥ Web ·þÎñÆ÷¿Ø¼þ¿ÉʹÓû§Äܹ»½«Ò³·¢Ë͵½·þÎñÆ÷²¢´¥·¢Ò³ÉϵÄʼþ¡£
Ò»¡¢±³¾°
¿ÉʹÓà Button Web ·þÎñÆ÷¿Ø¼þΪÓû§ÌṩÏò·þÎñÆ÷·¢ËÍÒ³µÄÄÜÁ¦¡£¸Ã¿Ø¼þ»áÔÚ·þÎñÆ÷´úÂëÖд¥·¢Ò»¸öʼþ£¬Äú¿ÉÒÔ´¦Àí¸ÃʼþÀ´ÏìÓ¦»Ø·¢¡£ÀýÈ磬Óû§¿ÉÒÔָʾÒÑÍê³É±íµ¥»òÏ£ÍûÖ´ÐÐÌØ¶¨µÄÃüÁî¡£
AS ......
Ê×ÏÈÌí¼ÓÒ»¸öÄ£°åÁУ¬ÄÚÈÝÈçÏÂ
<asp:TemplateField HeaderText="²Ù×÷">
<ItemTemplate>
<div onclick="return confirm('ÄúÈ·¶¨ÒªÉ¾³ýÂð£¿')">
  ......
ÑéÖ¤ÂëÓ¦Ó㺽«´úÂë¸´ÖÆµ½Ò³Ãæ¼´¿É£¬²¢½«Ò³ÃæµÄ·¾¶Ð´µ½Í¼Æ¬µÄurlÖбã¿ÉʹÓÃ
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebCont ......