• [编程开发]asp.net上传大文件控件

  • 网网网络  阅读[0]次  评论[0]条  发布时间:2009-10-17  发布人:网网网络

文章摘要:这段时间写了个asp.net上传大文件控件。经过测试,在ie中可显示进度条。特此共享,望广大网友多提意见。

  这段时间写了个asp.net上传大文件控件。经过测试,在ie中可显示进度条。特此共享,望广大网友多提意见。
  
  大文件上传控件(包含进度条)
  
  使用说明如下:
  
  〈summary〉
  
  上传进度条控件
  
  〈/summary〉
  
  〈example〉
  
  web.config配置
  
  〈?xmlversion="1.0"?〉
  
  〈configuration〉
  
  〈configsections〉
  
  〈!--上传节点--〉
  
  〈sectiongroupname="slickupload"〉
  
  〈sectionname="uploadlocationprovider"type="common.slickupload.configuration.uploadlocationproviderhandler,common"/〉
  
  〈/sectiongroup〉
  
  〈/configsections〉
  
  〈system.web〉
  
  〈httpruntimemaxrequestlength="2024000"executiontimeout="300"/〉
  
  〈httphandlers〉
  
  〈addverb="*"path="commontoolsashx.ashx"type="common.web.appcontrol.commontoolsashx,common"/〉
  
  〈addverb="*"path="commontoolsashx_xml.ashx"type="common.web.appcontrol.commontoolsashx_xml,common"/〉
  
  〈/httphandlers〉
  
  〈!--上传modules--〉
  
  〈httpmodules〉
  
  〈addname="httpuploadmodule"type="common.slickupload.httpuploadmodule,common"/〉
  
  〈/httpmodules〉
  
  〈/system.web〉
  
  〈appsettings〉
  
  〈!--上传临时路径--〉
  
  〈addkey="uploadpath"value="c:\tddownload\temp"/〉
  
  〈!--许可上传页面,多个页面用‘;‘分开--〉
  
  〈addkey="httpuploadmodulepagegoon"value="upload.aspx;"/〉
  
  〈/appsettings〉
  
  〈/configuration〉
  
  aspx页面
  
  //顶部
  
  〈%@registerassembly="common"namespace="common.web.appcontrol"tagprefix="cc1"%
  
  //form内
  
  〈asp:fileuploadid="fileuploadfile"runat="server"/〉
  
  〈asp:buttonid="btnupload"runat="server"onclick="button1_click"text="upload"/〉
  
  〈asp:hyperlinkid="hycancel"runat="server"〉cancel〈/asp:hyperlink〉
  
  〈cc1:webuploadprogressbarid="webuploadprogressbarcontrol"runat="server"uploadpath="c:\tddownload"〉〈/cc1:webuploadprogressbar〉
  
  aspx对应的cs代码
  
  protectedvoidpage_load(objectsender,eventargse)
  
  {
  
  //绑定上传客户端javascript事件
  
  this.btnupload.onclientclick=this.webuploadprogressbarcontrol.getuploadclick_javascript;
  
  //绑定上传取消客户端javascript事件
  
  this.hycancel.navigateurl="javascript:"+this.webuploadprogressbarcontrol.getuploadcancelclick_javascript;
  
  }
  
  protectedvoidbtnupload_click(objectsender,eventargse)
  
  {
  
  //上传文件
  
  this.webuploadprogressbarcontrol.saveuploadfiles();
  
  }
  
  〈/example〉
  
  〈remarks〉必须在iis站点下设置端口或虚拟目录方可测试通过。
  
  
顶一下
(1000)
50%
踩一下
(1000)
50%
【已有0位网友发表了看法,点击查看。】 复制本页共享msn或qq等好友
  • 发表人:      可输入字数[200]字
  • 验证码:验证码,看不清楚?请点击刷新验证码  请输入计算结果
  • 法律声明:网友评论仅供网友表达个人看法,并不表明网网网络同意其观点或证实其描述
48小时评论排行
    友情链接