asp.net 大文件上传控件
程序员文章站
2022-05-31 16:54:51
大文件上传控件(包含进度条) 使用说明如下: 上传进度条控件
大文件上传控件(包含进度条)
使用说明如下:
<summary>
上传进度条控件
</summary>
<example>
web.config 配置
<?xml version="1.0"?>
<configuration>
<configsections>
<!--上传节点-->
<sectiongroup name="slickupload">
<section name="uploadlocationprovider" type="common.slickupload.configuration.uploadlocationproviderhandler, common"/>
</sectiongroup>
</configsections>
<system.web>
<httpruntime maxrequestlength="2024000" executiontimeout="300"/>
<httphandlers>
<add verb="*" path="commontoolsashx.ashx" type="common.web.appcontrol.commontoolsashx, common" />
<add verb="*" path="commontoolsashx_xml.ashx" type="common.web.appcontrol.commontoolsashx_xml, common" />
</httphandlers>
<!--上传modules-->
<httpmodules>
<add name="httpuploadmodule" type="common.slickupload.httpuploadmodule, common"/>
</httpmodules>
</system.web>
<appsettings>
<!--上传临时路径-->
<add key="uploadpath" value="c:tddownloadtemp"/>
<!--许可上传页面,多个页面用';'分开-->
<add key="httpuploadmodulepagegoon" value="upload.aspx;"/>
</appsettings>
</configuration>
aspx页面
//顶部
<%@ register assembly="common" namespace="common.web.appcontrol" tagprefix="cc1" %>
//form内
<asp:fileupload id="fileuploadfile" runat="server" />
<asp:button id="btnupload" runat="server" onclick="button1_click" text="upload" />
<asp:hyperlink id="hycancel" runat="server">cancel</asp:hyperlink>
<cc1:webuploadprogressbar id="webuploadprogressbarcontrol" runat="server" uploadpath="c:tddownload"></cc1:webuploadprogressbar>
aspx对应的cs代码
protected void page_load(object sender, eventargs e)
{
//绑定上传客户端javascript事件
this.btnupload.onclientclick = this.webuploadprogressbarcontrol.getuploadclick_javascript;
//绑定上传取消客户端javascript事件
this.hycancel.navigateurl = "javascript:" + this.webuploadprogressbarcontrol.getuploadcancelclick_javascript;
}
protected void btnupload_click(object sender, eventargs e)
{
//上传文件
this.webuploadprogressbarcontrol.saveuploadfiles();
}
</example>
<remarks>必须在iis站点下设置端口或虚拟目录方可测试通过,又问题请和zljgood@hotmail.com联系</remarks>
使用说明如下:
<summary>
上传进度条控件
</summary>
<example>
web.config 配置
<?xml version="1.0"?>
<configuration>
<configsections>
<!--上传节点-->
<sectiongroup name="slickupload">
<section name="uploadlocationprovider" type="common.slickupload.configuration.uploadlocationproviderhandler, common"/>
</sectiongroup>
</configsections>
<system.web>
<httpruntime maxrequestlength="2024000" executiontimeout="300"/>
<httphandlers>
<add verb="*" path="commontoolsashx.ashx" type="common.web.appcontrol.commontoolsashx, common" />
<add verb="*" path="commontoolsashx_xml.ashx" type="common.web.appcontrol.commontoolsashx_xml, common" />
</httphandlers>
<!--上传modules-->
<httpmodules>
<add name="httpuploadmodule" type="common.slickupload.httpuploadmodule, common"/>
</httpmodules>
</system.web>
<appsettings>
<!--上传临时路径-->
<add key="uploadpath" value="c:tddownloadtemp"/>
<!--许可上传页面,多个页面用';'分开-->
<add key="httpuploadmodulepagegoon" value="upload.aspx;"/>
</appsettings>
</configuration>
aspx页面
//顶部
<%@ register assembly="common" namespace="common.web.appcontrol" tagprefix="cc1" %>
//form内
<asp:fileupload id="fileuploadfile" runat="server" />
<asp:button id="btnupload" runat="server" onclick="button1_click" text="upload" />
<asp:hyperlink id="hycancel" runat="server">cancel</asp:hyperlink>
<cc1:webuploadprogressbar id="webuploadprogressbarcontrol" runat="server" uploadpath="c:tddownload"></cc1:webuploadprogressbar>
aspx对应的cs代码
protected void page_load(object sender, eventargs e)
{
//绑定上传客户端javascript事件
this.btnupload.onclientclick = this.webuploadprogressbarcontrol.getuploadclick_javascript;
//绑定上传取消客户端javascript事件
this.hycancel.navigateurl = "javascript:" + this.webuploadprogressbarcontrol.getuploadcancelclick_javascript;
}
protected void btnupload_click(object sender, eventargs e)
{
//上传文件
this.webuploadprogressbarcontrol.saveuploadfiles();
}
</example>
<remarks>必须在iis站点下设置端口或虚拟目录方可测试通过,又问题请和zljgood@hotmail.com联系</remarks>
上一篇: 夏日DIY水果面膜 经济实惠又实用
下一篇: 如何打造完美肌肤 5条保养秘招教给你