日期:2014-05-17 浏览次数:20443 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!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 runat="server"> <title>无标题页</title> <script src="JavaScript/jquery-1.4.4.min.js" type="text/javascript"></script> <script src="xheditor/xheditor-1.1.10-zh-cn.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('#txtContent').xheditor({tools:'full',width:'680',height:'450',hoverExecDelay:-1,layerShadow:0,internalScript:true,inlineScript:true,linkTag:true,localUrl:'rel',upBtnText:'上传',upLinkUrl:'upload.aspx?immediate=1',upImgUrl:'{editorRoot}upload.aspx?immediate=1',upFlashUrl:'upload.aspx?immediate=1',upMediaUrl:'upload.aspx?immediate=1',emots:{qq:{name:'QQ',count:55,width:25,height:25,line:11},msn:{name:'MSN',count:40,width:22,height:22,line:8},bq1:{name:'bq1',count:48,width:128,height:128,line:5}},emotMark:true}); }); </script> </head> <body> <form id="form1" runat="server"> <div> <textarea id="txtContent" name="content" class="xheditor{upImgUrl:'upload.aspx?immediate=1'}" rows="12" cols="80">test</textarea> </div> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="true" CodePage="65001" %> <%@ Import namespace="System" %> <%@ Import namespace="System.Collections" %> <%@ Import namespace="System.Configuration" %> <%@ Import namespace="System.Data" %> <%@ Import namespace="System.Web" %> <%@ Import namespace="System.Web.Security" %> <%@ Import namespace="System.Web.UI" %> <%@ Import namespace="System.Web.UI.HtmlControls" %> <%@ Import namespace="System.Web.UI.WebControls" %> <%@ Import namespace="System.Web.UI.WebControls.WebParts" %> <script runat="server"> /* * upload demo for c# .net 2.0 * * @requires xhEditor * @author Jediwolf<jediwolf@gmail.com> * @licence LGPL(http://www.opensource.org/licenses/lgpl-license.php) * * @Version: 0.1.3 (build 100504) * * 注1:本程序仅为演示用,请您务必根据自己需求进行相应修改,或者重开发 * 注2:本程序将HTML5上传与普通POST上传转换为byte类型统一处理 * */ protected void Page_Load(object sender, EventArgs e) { Response.Charset = "UTF-8"; // 初始化一大堆变量 string inputname = "filedata";//表单文件域name string attachdir ="../upload"; // 上传文件保存路径,结尾不要带/ int dirtype = 1; // 1:按天存入目录 2:按月存入目录 3:按扩展名存目录 建议使用按天存 int maxattachsize = 2097152; // 最大上传大小,默认是2M string upext = "txt,rar,zip,jpg,jpeg,gif,png,swf,wmv,avi,wma,mp3,mid"; // 上传扩展名 int msgtype = 2; //返回上传参数的格式:1,只返回url,2,返回参数数组 string immediate = Request.QueryString["immediate"];//立即上传模式,仅为演示用 byte[] file; // 统一转换为byte数组处理 string localname = ""; string disposition = Request.ServerVariables["HTTP_CONTENT_DISPOSITION"]; string err = ""; string msg = "''"; if (disposition != null)