******作者语:这个控件很早就写了,但一直没有去完善***********************
******现在重新整理了一次,应该方便了许多,希望大家多多提意见*********
******该版本支持ASPNET1.0、2.0 ******************
******支持多个大文件队列传输传递*********************
****** 支持IE6、7/FF2.0、3.0 *************************************
****** ^(^]***************************

[ 版本更新 uploadfile 1.15  2008-1-15 by lt]
重要修改下:
1、修改文件字符集支持,如果遇到编码问题请把
< uploadctrl:ltuploadfilecontrol id ="ltuploadfilecontrol" runat ="server" Encode ="gb2312" FilePath = "\\files\\lt1" FileMax=20000000 > </ uploadctrl:ltuploadfilecontrol >
2、 FilePath和FileMax的全局问题已经修正,即使在同一个页面,多个上传控件实例之间的属性独立,例如:
< uploadctrl:ltuploadfilecontrol id ="ltuploadfilecontrolA" runat ="server" Encode ="gb2312" FilePath = "\\files\\lt1" FileMax=20000000 > </ uploadctrl:ltuploadfilecontrol >。    

< uploadctrl:ltuploadfilecontrol id ="ltuploadfilecontrolB" runat ="server" Encode ="gb2312" FilePath = "\\files\\lt3" FileMax=50000000 > </ uploadctrl:ltuploadfilecontrol >
可以成立,修正了FilePath 后,文件路径探测***已经被堵塞了,可以放心。
InBlock.gif private void Page_Load( object sender, System.EventArgs e)
InBlock.gif                    {
InBlock.gif                             if(!Page.IsPostBack)
InBlock.gif                            {
InBlock.gif                                     //使用控件需要以下4个步骤,应该不烦琐吧
InBlock.gif    
InBlock.gif                                     //ProcessBarBorderStyle控制进度条边框式样;不处理则用默认样式
InBlock.gif                                    LTAjaxUpFile.Uploadfile.ltuploadfilecontrol.ProcessBarBorderStyle = "BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 1px; BORDER-TOP: black 1px solid; PADDING-LEFT: 1px; VISIBILITY: hidden; PADDING-BOTTOM: 1px; BORDER-LEFT: black 1px solid; WIDTH: 200px; PADDING-TOP: 1px; BORDER-BOTTOM: black 1px solid";
InBlock.gif                                     //ProcessBarBorderStyle控制进度条颜色;不处理则用默认样式
InBlock.gif                                 LTAjaxUpFile.Uploadfile.ltuploadfilecontrol.ProcessBarBlockColor = "red";
InBlock.gif                                 //FeedbackDivCSS控制实时反馈信息式样;不处理则用默认样式
InBlock.gif                                 LTAjaxUpFile.Uploadfile.ltuploadfilecontrol.FeedbackDivCSS = "feedbackstyle";
InBlock.gif                                    
InBlock.gif                                 ltuploadfilecontrol.FilePath = "files\\lt1"; //1.这里可以动态设置上传的目录路径,文件名由控件自动生成
InBlock.gif                                 //FILE控件的CSS控制class;不处理则用默认式样
InBlock.gif                                 ltuploadfilecontrol.FileBoxCSSClass = "upfilebuttonstyle";
InBlock.gif                                    
InBlock.gif    
InBlock.gif                                 Ltuploadfilecontrol2.FilePath = "files\\lt1"; //1.这里可以动态设置上传的目录路径,文件名由控件自动生成
InBlock.gif                                 ltuploadfilecontrol.FileBoxCSSClass = "upfilebuttonstyle";
InBlock.gif                                    
InBlock.gif
InBlock.gif                                 Ltuploadfilecontrol3.FilePath = "files\\lt1"; //1.这里可以动态设置上传的目录路径,文件名由控件自动生成
InBlock.gif                                 ltuploadfilecontrol.FileBoxCSSClass = "upfilebuttonstyle";
InBlock.gif                                    
InBlock.gif    
InBlock.gif                                    
InBlock.gif                                 //3.UploadOkEventHandler事件为文件上传完毕后处理回调
InBlock.gif                                 ltuploadfilecontrol._UploadOkEventHandler+= new LTAjaxUpFile.Uploadfile.ltuploadfilecontrol.GetFilePath(userFileUpLoadFinishedEventHandler);
InBlock.gif                         }
InBlock.gif                         // 在此处放置用户代码以初始化页面
InBlock.gif                 }
InBlock.gif    
InBlock.gif                 //4.定义一个事件处理过程加入到UploadOkEventHandler中
InBlock.gif                 //事件在参数-servpath中返回服务器的文件保存绝对路径,-oldfilename则是原来的文件名字
InBlock.gif                 private void userFileUpLoadFinishedEventHandler( string servpath, string oldfilename)
InBlock.gif                 {
InBlock.gif                         //可以在这里处理它们,比如放到数据库等,
InBlock.gif                         FileStream fs = new FileStream(Server.MapPath( "file.txt"),FileMode.Create,FileAccess.ReadWrite);
InBlock.gif                         byte[] bs = Encoding.GetEncoding( "gb2312").GetBytes(servpath);
InBlock.gif                         byte[] bs1 = Encoding.GetEncoding( "gb2312").GetBytes( "\r\n"+oldfilename);
InBlock.gif                         fs.Write(bs,0,bs.Length);
InBlock.gif                         fs.Write(bs1,0,bs1.Length);
InBlock.gif                         fs.Close();
InBlock.gif                 }

 
下载uploadfile.DLL组件  【解压后覆盖范例项目BIN下旧版本即可】

1.在webconfig中添加以下内容:
注意:如果遇到URL重写,请确保上传控件的载入先于重写控件,即把ADD节点放在重写控件的ADD前面
< httpHandlers >
                 < add verb ="*" path ="uploadfile.aspx" type ="LTAjaxUpFile.hc.UpFile,Uploadfile" />
                 < add verb ="*" path ="QueryLoadStatu.aspx" type ="LTAjaxUpFile.Uploadfile.QueryLoadStatu,Uploadfile" />
</ httpHandlers >
2、 FilePath属性中指定的路径通常如果不存在,控件可自动创建,但由于某些空间配置问题无法创建,所以最好能在空间自己手动建立该文件夹,这样就万无一失了。
3.参照default.aspx的例子 
请在页面中注册本控件
<%@ Register TagPrefix="uploadctrl" Namespace="LTAjaxUpFile.Uploadfile" Assembly="Uploadfile"%>