ASP.NETÖжÔͼƬµÄ¹ÜÀí
Ò»¡¢ÉÏ´«Í¼Æ¬£º
½«Í¼Æ¬´æ´¢ÔÚimageÎļþ¼ÐÖУ¬È»ºó°ÑͼƬµÄ·¾¶´æÔÚÊý¾Ý¿âÀÕâÑùÓõÄʱºò´ÓÊý¾Ý¿âÖÐËÑË÷³ö·¾¶È»ºó°ó¶¨ÔÚǰ̨ҳÃæµÄ<image/>±êÇ©ÖУ¬¾ÍÄÜÏÔʾÎÒÃÇÏëÒªµÄͼƬ¡£
ǰ̨´úÂ룺
ÉÌƷͼƬ£º<asp:FileUpload ID="ImageUpload" runat="server" />
<asp:Label ID="TipForImage" runat="server"></asp:Label>
<br />
<asp:Image ID="Image1" runat="server" />
<br />
ºǫ́´úÂ룺
/// <summary>
/// ÉÏ´«Í¼Æ¬
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Upload_Click(object sender, EventArgs e)
{
//»ñÈ¡Ëù´«ÕÕƬµÄ·¾¶Ãû
string filename = ImageUpload.FileName;
//»ñÈ¡¸ÃÕÕƬµÄÃû×ÖºÍÀàÐÍ
string picture=filename.Substring(filename.LastIndexOf("/")+1);
//"image/"×ֶμÓÉÏÕÕƬµÄÃû×ÖºÍÀàÐÍ£¬½«Æä´æ´¢ÔÚÊý¾Ý¿âµÄpictureÁÐÖУ¬ÒÔ±ã²éѯµÄʱºò½øÐÐËÑË÷
string str = "image/";
str += picture;
//½«ÕÕƬ´æ´¢ÔÚimageÎļþ¼ÐÖÐ
string path = Server.MapPath("image/") + filename;
ImageUpload.SaveAs(path);
//Label"Image1"ÖеÄÕÕƬÏÔʾ
Image1.ImageUrl = "image/" + filename;
//½«ÐÅÏ¢´æ´¢ÔÚÊý¾Ý¿âÖÐ
SQLHelper sqlhelp = new SQLHelper();
sqlhelp.Openconn
Ïà¹ØÎĵµ£º
ÓÉÓÚÑéÖ¤Âë¼¼ÊõÖзþÎñÆ÷³ÌÐòÐèÒª´´½¨ÑéÖ¤ÂëͼƬ£¬ÀïÃæÓõ½ÁËͼÐαà³Ì£¬Òò´Ë±¾½Ú¿Î³ÌÈÔÈ»ÊÇC#·¢ÏÖÖ®ÂõÄͼÐαà³ÌϵÁн̡̳£
¸ù¾ÝÑéÖ¤ÂëµÄÔÀí£¬ÎÒÃÇʹÓÃC#ÔÚASP.NETÖÐʵÏÖÁËÑéÖ¤ÂëµÄ¹¦ÄÜ¡£
checkimage.aspx
Ê×Ïȸù¾ÝÉϽڿγ̵ÄÄÚÈÝ£¬ÎÒÃÇÒª´´½¨Ò»¸öͼƬ·þÎñҳà ......
ËÄ¡¢ÈçºÎ£ºÏìÓ¦Áбí Web ·þÎñÆ÷¿Ø¼þÖеĸü¸Ä
±¾Ö÷ÌâÖеÄÐÅÏ¢ÊÊÓÃÓÚÈçÏÂÁбí Web ·þÎñÆ÷¿Ø¼þ£ºListBox¡¢DropDownList¡¢CheckBoxList ºÍ RadioButtonList¡£
µ±Óû§ÔÚÁбí Web ·þÎñÆ÷¿Ø¼þÖнøÐÐÑ¡Ôñʱ£¬¿Ø¼þ½«Òý·¢Ò»¸öʼþ£¬Äú¿ÉÒÔÖ±½Ó¶Ô¸Ãʼþ×ö³öÏìÓ¦¡£Í¨³£¸ù±¾²»ÐèÒªÖ±½Ó¶ÔÑ¡Ôñʼþ½øÐÐÏì ......
ÏÂÃæ½éÉÜÈçºÎ½øÐÐASP.NETÖÐÍøÕ¾·ÃÎÊÁ¿µÄͳ¼Æ¡£
Ò»¡¢½¨Á¢Ò»¸öÊý¾Ý±íIPStatÓÃÓÚ´æ·ÅÓû§ÐÅÏ¢
ÎÒÔÚIPStat±íÖдæ·ÅµÄÓû§ÐÅÏ¢Ö»°üÀ¨µÇ¼Óû§µÄIP£¨IP_Address£©£¬IPÀ´Ô´£¨IP_Src£©ºÍµÇ¼ʱ¼ä£¨IP_DateTime£©£¬Ð©±íµÄÐÅÏ¢±¾ÈËÖ»±£´æÒ»ÌìµÄÐÅÏ¢£¬Èç¹ûҪͳ¼Æÿ¸öÔµÄÐÅÏ¢ÔòÒª±£´æÒ»¸öÔ¡£
¶þ¡¢ÔÚGlobal.asaxÖлñÈ¡Óû§ÐÅÏ¢ ......
<%=%>°ó¶¨CSÎļþÖеıäÁ¿£¬ÓÐÖµµÄÊôÐÔ£¬»òÕßÓзµ»ØÖµµÄ·½·¨£¬
<%#%>Ò»°ãʽ·ÅÔÚÊý¾Ý¿Ø¼þÖаó¶¨Êý¾ÝÔ´±íÖеÄ×Ö¶Î
<%=%><%#%>Çø±ð:
Ç°Õß ÊÇÔÚÒ³ÃæÖ®ÖÐʹÓÃ.ÊôÓÚÒ»¶Î´úÂë.ÓÐ=ºÅµÄ¾ÍÏ൱ÓÚresponse.write()Õ⹦ÄÜ.ºÍaspÒ»Ñù.
ºóÕß ÊÇÔÚÒ³ÃæÖеķþÎñÆ÷Êý¾Ý¿Ø¼þÖаó¶¨Êý¾ÝÔ´µÄ×ֶΠ......
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
¡¡¡¡µÚÒ»²½¡¡ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C#»òVB.NET ÎÒÇ¿ÁÒ·´¶ÔÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó(OO)ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£ ASP.NETÊÇÒ»¸öÈ«ÃæÏò¶ÔÏóµÄ¼¼Êõ£¬²»¶®OO£¬ÄǾø¶Ôѧ²»ÏÂÈ¥!
¡¡
¡¡µÚ¶þ²½¡¡¶Ô.NET FrameworkÀà¿âÓÐÒ»¶¨µÄÁ˽⠿ÉÒÔͨ¹ý¿ª·¢Windows Fo ......