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
Ïà¹ØÎĵµ£º
Ê×Ò³£º
<%@ 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" >
<head ......
ĸ°æÒ³Ãæ
-- н¨Ò»Ä¸°æÒ³Ãæ
-- ÔÚÊʵ±Î»ÖüÓÈë´úÂ룺
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
...ÕâÖ®¼äµÄÄÚÈÝÈç¹ûûÓÐContentÄÚÈÝ£¬½«»áµÃµ½ÏÔʾ£»
...Èç¹ûÓÐContentÄÚÈÝ£¬½«»á±»ContentÄÚÈÝÌæ»»µô
</asp:ContentPlaceHolder>
ContentÒ³Ãæ
-- н¨Ò»WEB´°Ìå
-- ÔÚÊʵ± ......
ʾÀýÒ»
ÔÚGlobal.asax.csÎļþÖУº
protected void Application_Start(Object sender, EventArgs e)
{
System.Timers.Timer timer1 = new System.Timers.Timer();
&nbs ......
ASP.NET³ÌÐòÖг£ÓôúÂë»ã×Ü
1.×Ô¶¨ÒåÒì³£´¦Àí
//×Ô¶¨ÒåÒì³£´¦ÀíÀà
using System;
using System.Diagnostics;
namespace MyAppException
{
¡¡/// £¼summary£¾
¡¡/// ´ÓϵͳÒì³£ÀàApplicationException¼Ì³ÐµÄÓ¦ÓóÌÐòÒì³£´¦ÀíÀà¡£
¡¡/// ×Ô¶¯½«Òì³£ÄÚÈݼǼµ½Windows NT/2000µÄÓ¦ÓóÌÐòÈÕÖ¾
¡¡/// £¼/summary£¾
......
ÔÚASP.NETÖУ¬Îļþ´¦ÀíµÄÕû¸ö¹ý³Ì¶¼ÊÇΧÈÆ×ÅSystem.IO Õâ¸öÃû³Æ¿Õ¼äÕ¹¿ªµÄ¡£Õâ¸öÃû³Æ¿Õ¼äÖоßÓÐÖ´ÐÐÎļþ¶Á¡¢Ð´ËùÐèÒªµÄÀà¡£±¾ÎÄ´Ó×î»ù±¾µÄ²Ù×÷¿ªÊ¼£¬½âÊÍÔÚASP.NETÖÐÎļþ´¦ÀíµÄ¸ÅÄ°üÀ¨Èç´ÓÒ»¸öÎļþÖжÁÈ¡ÄÚÈÝ¡¢ÈçºÎÏòÒ»¸öÎļþÖÐдÈëÄÚÈݺÍÈçºÎɾ³ýÒ»¸öÎļþ¡£¡¡¡¡
Ç°ÃæÒѾÌáµ½£¬ÒªÏëÔÚASP.NET Ò³ÃæÖнøÐÐÎļþ´¦Àí£¬±ØÐ ......