asp.net ÊüÕÖ²ãÉÏ´«Í¼Æ¬(¶þ½øÖÆ),²¢ÏÔʾ¶þ½øÖÆͼƬ
1.ÉÏ´«¹¦ÄÜ
JS¼ì²é
function hideUpImg()//¹Ø±Õ²ã£¬²¢ÉÏ´«Í¼Æ¬
{
var v=document.getElementById("upImg").value;
var after=v.substring(v.lastIndexOf('.')).toLowerCase();
alert(after);
if(v.length<=0)
{
alert("ÇëÑ¡ÔñͼƬ");
return false;
}
if(after==".jpg"||after==".gif"||after==".png")
{
return true;
}
alert("ͼƬֻÄÜÊÇ.jpg .gif .png¸ñʽ");
document.getElementById("upImg").outerHTML=document.getElementById("upImg").outerHTML;
return false;
}
Ò³Ãæ´úÂ룺
<div id="myDiv" style="display: none;" mce_style="display: none;" class="divshowbottom"> </div>
<div id="upLoadImg" style="top: 200px;left: 300px;display: none;" class="divshowwork">
<div style="width: 100%; height: 20px;background-color: #FF0000; cursor: move;">ÉÏ´«Í¼Æ¬</div>
<p style="text-align: center;" mce_style="text-align: center;">ÇëÉÏ´«Í¼Æ¬</p>
<asp:FileUpload ID="upImg" runat="server" />
<asp:Label ID="lblState" runat="server" ></asp:Label>
<br /><asp:Button ID="btnUpImg" runat="server" Text="ÉÏ´«" OnClick="btnUpImg_Click" /> <input type="button" value="È¡Ïû" id="button_2" />
</div>
ºǫ́´úÂë:
Stream stream = this.upImg.PostedFile.InputStream;
byte[] photo = new byte[upImg.PostedFile.ContentLength];
stream.Read(photo, 0, upImg.PostedFile.ContentLength);
ItemMaster im = new ItemMaster();
im.ItemUid =Convert.ToInt32(s.Split('|')[1]);
im.Drawing = photo;
int upd = ItemMasterBIZ.UpdItemMasterByImg(im);
stream.Cl
Ïà¹ØÎĵµ£º
substring
public String substring(int beginIndex)·µ»ØÒ»¸öеÄ×Ö·û´®£¬ËüÊÇ´Ë×Ö·û´®µÄÒ»¸ö×Ó×Ö·û´®¡£¸Ã×Ó×Ö·û´®Ê¼ÓÚÖ¸¶¨Ë÷Òý´¦µÄ×Ö·û£¬Ò»Ö±µ½´Ë×Ö·û´®Ä©Î²¡£
ÀýÈ磺
"unhappy".substring(2) returns "happy"
"Harbison".substring(3) returns "bison"
"emptiness".substring(9) returns "" (an empty string)
² ......
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is ......
Ç°ÑÔ£ºµ±Ò»¸öHttpÇëÇó·¢Ë͸øÒ»¸öaspxÒ³Ãæʱ,·þÎñÆ÷½øÐÐÁËÄÄЩ²Ù×÷£¿ÓÖÈçºÎÀ´½âÎöÕâ¸öÇëÇó£¿ASP.NETÔÚ½ÓÊÕÇëÇóºóÊÇÔõôÔËÐеģ¬ÈçÔõô±àÒëÒÔ¼°ÔõôÑùÓÃÍйܵĴúÂëÀ´ÔËÐеģ¿.....Àí½âÕâЩÎÊÌ⣬ʹÎÒÃÇ¿ÉÒÔ¸ü¼ÓºÃµÄ¿ª·¢ASP.NET¡£
¡¡¡¡1.µ±ÎÒÃÇÔÚä¯ÀÀÆ÷ÖÐÇëÇóÒ»¸öASP.NETÍøÕ¾µÄij¸öÒ³ÃæµÄʱºò£¬È磬ÎÒÃÇÔÚä¯ÀÀÆ÷ÖÐÊäÈë" ......
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
< ......