NeatUpload 的使用

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

来自 <http://www.cnblogs.com/zhhe0800/p/little_ant.html>

1 <security>
2 <requestFiltering>
3 <requestLimits maxAllowedContentLength="1073741824"/>
4 </requestFiltering>
5 </security>

来自 <http://www.cnblogs.com/zhhe0800/p/little_ant.html>

1 <modules>
2 <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />
3 </modules>

来自 <http://www.cnblogs.com/zhhe0800/p/little_ant.html>

1 protected void btnSave_Click(object sender, EventArgs e)
2 {
3 if (AttachFile.HasFile)
4 {
5 string FileName = this.AttachFile.FileName;//获取上传文件的文件名,包括后缀
6 string ExtenName = System.IO.Path.GetExtension(FileName);//获取扩展名
7 string SaveFileName = System.IO.Path.Combine(
8 System.Web.HttpContext.Current.Request.MapPath("UpLoads/"),
9 DateTime.Now.ToString("yyyyMMddhhmm") + ExtenName);//合并两个路径为上传到服务器上的全路径
10 AttachFile.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
11 string url = "UpLoads/" + DateTime.Now.ToString("yyyyMMddhhmmss") + ExtenName; //文件保存的路径
12 float FileSize = (float)System.Math.Round((float)AttachFile.ContentLength / 1024000, 1); //获取文件大小并保留小数点后一位,单位是M
13 }
14 }

来自 <http://www.cnblogs.com/zhhe0800/p/little_ant.html>

1 <body>
2 <form id="form1" runat="server">
3 <div>
4 <Upload:InputFile ID="AttachFile" runat="server"/>
5 <Upload:ProgressBar ID="ProgressBar1" runat='server'>
6 </Upload:ProgressBar>
7 </div>
8 <div>
9 <asp:Button ID="btnSave" runat="server" Text="保存" OnClick="btnSave_Click" />
10 </div>
11 </form>
12 </body>

来自 <http://www.cnblogs.com/zhhe0800/p/little_ant.html>

posted @ 2016-12-21 10:07  爱笑的3  阅读(333)  评论(0编辑  收藏  举报