惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Privacy International News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
Project Zero
Project Zero
T
Threatpost
Spread Privacy
Spread Privacy
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
AWS News Blog
AWS News Blog
H
Heimdal Security Blog
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
J
Java Code Geeks
罗磊的独立博客
博客园 - Franky
博客园 - 叶小钗
S
Security Affairs
月光博客
月光博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Last Watchdog
The Last Watchdog
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
A
Arctic Wolf
Cloudbric
Cloudbric
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V2EX - 技术
V2EX - 技术
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 最新话题
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News | PayPal Newsroom
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
W
WeLiveSecurity
云风的 BLOG
云风的 BLOG
The Register - Security
The Register - Security
I
InfoQ
F
Fortinet All Blogs
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
Lohrmann on Cybersecurity

博客园 - 叶子绿了

freemarker显示含有html代码的内容 .net sql 防注入 httpmodule [转载]poi导出excel,可以自定义保存路径 jquery ajax 传递js对象到后台 Struts2下多文件的上传与下载 dwr框架 Oracle 9i中包含Connect by 子句的查询向Oracle 10g移植后运行时错误及解决方法 JQuery Uploadify 基于JSP的无刷新上传实例 写了个用jquery控制select只读(select选项可以供用户查看但不能改变初始选中值) C#之模态窗口关闭 repeater相同行合并 在Web站点中创建和使用Rss源(动态) silverlight xml查询 silverlight 3 数据绑定及分页 解决ASP.NET中Image控件不能自动刷新 解决UpdatePanel无法直接弹出窗口的问题 导入Excel数值读不到,找不到可安装的 ISAM错误! 浏览器不能正常解析CSS代码的解决 ajax在用户注册中的应用,类似淘宝网
asp.net2.0 上传大容量文件第三方控件radupload
叶子绿了 · 2010-01-25 · via 博客园 - 叶子绿了

1.web.config  中的<system.web>加入:
 <httpHandlers>
    <add verb="*" path="Telerik.RadUploadProgressHandler.aspx" type="Telerik.WebControls.RadUploadProgressHandler, RadUpload.Net2" />
 </httpHandlers>
 <httpModules>
      <add name="RadUploadModule" type="Telerik.WebControls.RadUploadHttpModule, RadUpload.Net2" />
 </httpModules>

2.引用并声明使用

页面中:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="RadUpload.Net2" Namespace="Telerik.WebControls" TagPrefix="radU" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <radU:RadProgressManager ID="RadProgressManager1" runat="server" />
        &nbsp;<br />
        <input id="file1" runat="server" class="uploadBox" name="file1" type="file" /><br />
        <radU:RadProgressArea ID="RadProgressArea1" runat="server">
        </radU:RadProgressArea>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></div>
    </form>
</body>
</html>

后置代码:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.WebControls;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        //生成GUID
        Guid id = System.Guid.NewGuid();
    
        foreach (UploadedFile up in RadUploadContext.Current.UploadedFiles)
        {
            string fileName = up.GetName();
            int index = fileName.LastIndexOf(".");
            string type = fileName.Substring(index);

            up.SaveAs(Server.MapPath("~/upload")+"\\" + id.ToString() + type, true);
        }
    }
}

3.文件大小的控制,如果太大会出现页面报错。
web.config  中的<system.web>加入 
<httpRuntime maxRequestLength="2040000" executionTimeout="9000"/>