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>");
}
}
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔǰµÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕß¶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
¾Å¡¢ÒÔ±à³Ì·½Ê½Ìí¼Ó ASP.NET ¿Ø¼þ
ÓÐʱ£¬ÔÚÔËÐÐʱ´´½¨¿Ø¼þ±ÈÔÚÉè¼ÆÊ±´´½¨¿Ø¼þ¸ü¿ÉÐС£ÀýÈ磬¼Ù¶¨ÓÐÒ»¸öËÑË÷½á¹ûÒ³£¬ÄúÒªÔÚÆäÖн«ÒÔ±íµÄÐÎʽÏÔʾ½á¹û¡£ÓÉÓÚ²»ÖªµÀÒª·µ»Ø¶àÉÙÏÒò´ËÄúÐèҪÿ¸ö·µ»ØµÄÏ̬Éú³ÉÒ»¸ö±íÐС£
˵Ã÷£º ÏÖÓпؼþͨ³£¿ÉÒÔÌṩ´Ó¶¯ ......
ÍøÕ¾¾³£ÏÔʾ¹ã¸æ»òÑûÇëÓû§·ÃÎÊÆäËûÕ¾µãµÄÀàËÆ¶¯Ì¬ÄÚÈÝ¡£ASP.NET ÌṩµÄ AdRotator ¿Ø¼þ¿É¼ò»¯´ËÈÎÎñ¡£AdRotator ¿Ø¼þÏÔʾ±íʾ¹ã¸æµÄͼÐΣ¬¶ø¹ã¸æÊÇ´ÓÄú´´½¨µÄÁбíÖÐËæ»úÑ¡ÔñµÄ¡£È»ºó£¬¿ÉÒÔ¸ú×Ùij¸ö¹ã¸æµÄ²é¿´ÆµÂÊÒÔ¼°Óû§µ¥»÷¸Ã¹ã¸æÆµÂÊ¡£
±¾ÑÝÁ·ÑÝʾÈçºÎʹÓà AdRotator ¿Ø¼þÏÔʾ¹ã¸æ£¬²¢Ìṩһ¸ö¼òµ¥·½·¨À´¸ú×Ù¹ã¸æÏì ......
ÕâÁ½Õß±¾Éí½²µÄÊDz»Í¬·½ÏòÓë½Ç¶ÈµÄÎÊÌ⣬ÔÚʵ¼ÊÓ¦ÓÃÖÐËûÃǵÄÈ·´æÔÚһЩÏàËÆµÄÌØµã£¬ÔںܶàÊé¼®ÖÐҲûÓÐÉîÈë½²½â£¬ÒÔÖÂÓÚÔì³ÉÀ§»ó£¬ÎªÁ˸üºÃµÄÀí½âËûÃÇ£¬ÄǾÍÀ´ËµËµÇø±ð°É¡£
¡¡¡¡Ê×ÏÈN²ã½á¹¹ÊÇÒ»ÖÖÈí¼þ³éÏóµÄ²ã´Î½á¹¹£¬ÊǶԸ´ÔÓÈí¼þµÄÒ»ÖÖ×ÝÏòÇз֣¬Ã¿Ò»²ã´ÎÖÐÍê³ÉͬһÀàÐ͵IJÙ×÷£¬ÒԱ㽫¸÷ÖÖ´úÂëÒÔÆäÍê³ÉµÄʹÃü×÷ÎªÒ ......
ʹÓà ASP.NET °´Å¥ Web ·þÎñÆ÷¿Ø¼þ¿ÉʹÓû§Äܹ»½«Ò³·¢Ë͵½·þÎñÆ÷²¢´¥·¢Ò³ÉϵÄʼþ¡£
Ò»¡¢±³¾°
¿ÉʹÓà Button Web ·þÎñÆ÷¿Ø¼þΪÓû§ÌṩÏò·þÎñÆ÷·¢ËÍÒ³µÄÄÜÁ¦¡£¸Ã¿Ø¼þ»áÔÚ·þÎñÆ÷´úÂëÖд¥·¢Ò»¸öʼþ£¬Äú¿ÉÒÔ´¦Àí¸ÃʼþÀ´ÏìÓ¦»Ø·¢¡£ÀýÈ磬Óû§¿ÉÒÔָʾÒÑÍê³É±íµ¥»òÏ£ÍûÖ´ÐÐÌØ¶¨µÄÃüÁî¡£
AS ......