点击回首页
我的浏览记录 | | 帮助?
当前位置:

源码截图

源码目录树

当前路径:App-Code/Upload.cs     using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
//该源码下载自www.51aspx.com(51aspx.com)

/// <summary>
/// 上传文件事件;
/// </summary>
public class Upload : IHttpHandler, IRequiresSessionState
{    
    public Upload()
    {
    }

    #region IHttpHandler Members

    public bool IsReusable
    {
        get { return true; }
    }

    public void ProcessRequest(HttpContext context)
    {
        string temp = context.Session["temp"].ToString();

        string EncryptString = context.Request.QueryString["User"];
        
        if (temp!="" && context.Request.Files.Count > 0 )
        {
		
            string uploadPath = context.Server.MapPath(context.Request.ApplicationPath + "/Upload/" +temp);
 		if (Directory.Exists(uploadPath) == false)
           	 {
               		 Directory.CreateDirectory(uploadPath);
           	 }
           
            for(int j = 0; j < context.Request.Files.Count; j++)
            {
               
                HttpPostedFile uploadFile = context.Request.Files[j];
               
                if (uploadFile.ContentLength > 0)
                {
                    
                    uploadFile.SaveAs(Path.Combine(uploadPath, uploadFile.FileName));        
                }                
            }
        }
        
        //HttpContext.Current.Response.Write(" ");
       
    }

    #endregion
}
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途) 企业QQ:4000410510
地址:北京市海淀区中关村鼎好大厦A座二层 邮编:100080
Room A-801,Dinghao Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2015. 京ICP备09089570号 | 京公网安备11010702000869号
在线客服
分享该页面
关闭侧边栏