华东15选5不开奖

asp.net neatUpload 支持大文件上傳組件

asp.net neatUpload 支持大文件上傳組件,Brettle.Web.NeatUpload.dll,可以看到工具箱中出現InputFile等控件
關鍵字:asp.net、neatUpload

1.在工具箱中添加Brettle.Web.NeatUpload.dll,可以看到工具箱中出現InputFile等控件。
2.復制文件夾NeatUpload到根目錄.
3.拖放使用上傳控件InputFile和進度條ProgressBar,添加上傳文件的按鈕.aspx頁面代碼如下:

復制代碼 代碼如下:

<body>
<form id="form1" runat="server">
<div>
<upload:InputFile id="AttachFile" runat="server"></upload:InputFile>
<asp:Button ID="Upload" runat="server" Text="Upload" OnClientClick="ToggleVisibility('ProgressBar','on')" OnClick="Upload_Click"/>
<div id="ProgressBar" style="display:none;">
<upload:progressbar id="pbProgressBar" runat="server" Inline="true" Width="500px" Height="100"> </upload:progressbar>
</div>
</div>
</form>
</body>

4.添加腳本代碼ToggleVisiblity函數到頁面上如下:
復制代碼 代碼如下:

<script type="text/javascript" language="javascript">
function ToggleVisibility(id, type)
{
el = document.getElementById(id);
if(el.style)
{
if(type == 'on')
{

el.style.display = 'block';
}
else
{

el.style.display = 'none';
}
}
else
{
if(type == 'on')
{

el.display = 'block';
}
else
{

el.display = 'none';
}
}
}
</script>


5.給上傳文件的按鈕添加事件Upload_Click

復制代碼 代碼如下:

protected void Upload_Click(object sender, EventArgs e)
{
string FileName = this.AttachFile.FileName;//獲取上傳文件的全路徑
string ExtenName = System.IO.Path.GetExtension(FileName);//獲取擴展名
string SaveFileName = System.IO.Path.Combine(Request.PhysicalApplicationPath, DateTime.Now.ToString("yyyyMMddhhmm") + ExtenName);//合并兩個路徑為上傳到服務器上的全路徑
if (this.AttachFile.ContentLength > 0)
{
try
{
this.AttachFile.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
}
catch (Exception ex)
{
throw ex;
}
}
}

6.在配置文件web.config中添加http模塊聲明:
復制代碼 代碼如下:

<httpModules>
<add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />
</httpModules>


7.需要在web.config進行其他一些設置才能保證完美。
在<configuration>里面加入
復制代碼 代碼如下:

<configSections>
<sectionGroup name="system.web">
<section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
</sectionGroup>
</configSections>

在 <system.web>加入
復制代碼 代碼如下:

<neatUpload useHttpModule="false" maxNormalRequestLength="4096" maxRequestLength="2097151" defaultProvider="FilesystemUploadStorageProvider">
<providers>
<add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload" />
</providers>
</neatUpload>

在<configuration>里面的后面位置加入
復制代碼 代碼如下:

<location path="Default.aspx" >
<system.web>
<neatUpload useHttpModule="true" />
<httpRuntime maxRequestLength="2097151" executionTimeout="3600" useFullyQualifiedRedirectUrl="true" />
</system.web>
</location>
</configuration>

地址下載,里面有詳細的使用文檔

华东15选5不开奖
2217游戏平台首页 股票涨跌排行榜 体彩四川金7乐结果 体彩大乐透预测 比分网即时比分电竞 美拍上面的吃播都很赚钱吗 今天安徽25选5开奖结果 搜索河南11选5 冰球比分 足彩胜负彩18087预测