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
Ïà¹ØÎĵµ£º
16. Êʵ±µØÊ¹Óù«¹²ÓïÑÔÔËÐпâµÄÀ¬»ø»ØÊÕÆ÷ºÍ×Ô¶¯ÄÚ´æ¹ÜÀí ¡¡¡¡
СÐIJ»Òª¸øÃ¿¸öÇëÇó·ÖÅä¹ý¶àÄڴ棬ÒòΪÕâÑùÀ¬»ø»ØÊÕÆ÷½«±ØÐë¸üƵ·±µØ½øÐиü¶àµÄ¹¤×÷¡£ÁíÍ⣬²»ÒªÈò»±ØÒªµÄÖ¸ÕëÖ¸Ïò¶ÔÏó£¬ÒòΪËüÃǽ«Ê¹¶ÔÏ󱣳ֻ״̬£¬²¢ÇÒÓ¦¾¡Á¿±ÜÃ⺬ Finalize ·½·¨µÄ¶ÔÏó£¬ÒòΪËüÃÇÔÚºóÃæ»áµ¼Ö¸ü¶àµÄ¹¤×÷¡£ÌرðÊÇÔÚ Finalize µ÷ÓÃÖ ......
Êý¾Ý°ó¶¨¸ÅÊöºÍÓï·¨
ASP.NET ÒýÈëÁËеÄÉùÃ÷ÐÔÊý¾Ý°ó¶¨Óï·¨¡£ÕâÖַdz£Áé»îµÄÓï·¨ÔÊÐí¿ª·¢ÈËÔ±²»½ö¿ÉÒ԰󶨵½Êý¾ÝÔ´£¬¶øÇÒ¿ÉÒ԰󶨵½¼òµ¥ÊôÐÔ¡¢¼¯ºÏ¡¢±í´ïʽÉõÖÁÊÇ´Ó·½·¨µ÷Ó÷µ»ØµÄ½á¹û¡£Ï±íÏÔʾÁËÐÂÓï·¨µÄһЩʾÀý¡£
¼òµ¥ÊôÐÔ Customer: <%# custID %>
¼¯ºÏ Orders: <asp:ListBox id="List1" datasour ......
ÈçºÎÔËÓà Form ±íµ¥ÈÏÖ¤
ASP.NET µÄ°²È«ÈÏÖ¤£¬¹²ÓГWindows”“Form”“Passport”“None”ËÄÖÖÑé֤ģʽ¡£“Windows”Óë“None”ûÓÐÆðµ½±£»¤µÄ×÷Ó㬲»ÍƼöʹÓ㻓Passport”ÎÒÓÖûÓùý£¬°¦……ËùÒÔÎÒÖ»ºÃ½²½²“Form”ÈÏ ......
±íµ¥formµÄÌá½»ÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇgetµÄ·½·¨£¬Ò»ÖÖÊÇpost µÄ·½·¨.¿´ÏÂÃæ´úÂë,Àí½âÁ½ÖÖÌá½»µÄÇø±ð:
1 <form id="form1" method="get" runat="server">
2 <div>
3 ÄãµÄÃû×Ö<asp:TextBox ID="name" runat="server">< ......