多文件的上传

前台代码:
 1using System;
 2using System.Data;
 3using System.Configuration;
 4using System.Collections;
 5using System.Web;
 6using System.Web.Security;
 7using System.Web.UI;
 8using System.Web.UI.WebControls;
 9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11
12
13/// <summary>
14/// 功能:多文件上传
15/// ///         遍利这个集合,得到每一个
16/// 解决方案:采用Request.Files来得客户端上载的文件集合
17///         返回一个System.Web.HttpFileCollection,最后

18上传的文件加以保存
19/// 
20/// 时间:二00八年一月二十五日
21/// 
22/// 作者:曹代明
23/// 
24/// </summary>

25public partial class Jun_ManyFileUpload : System.Web.UI.Page
26{
27    protected void Page_Load(object sender, EventArgs e)
28    {
29
30    }

31    protected void btnupload_Click(object sender, EventArgs e)
32    {
33        UploadFile();
34    }

35
36    公共方法
67}

68

后台代码:
 1<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManyFileUpload.aspx.cs" Inherits="Jun_ManyFileUpload" %>
 2
 3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 4
 5<html xmlns="http://www.w3.org/1999/xhtml" >
 6<head runat="server">
 7    <title>无标题页</title>
 8    
 9   <style type="text/css">
10<!--
11body {
12    background-image: url(../image/board.jpg);
13    margin-left: 20px;
14    margin-top: 20px;
15    margin-right: 20px;
16    margin-bottom: 20px;
17}

18
19-->
20</style>
21<link href="../css/sitetype.css" rel="stylesheet" type="text/css" />
22<style type="text/css">
23<!--
24.STYLE1 {color: #FF0000}
25-->
26</style>
27<script language="javascript" type="text/javascript"></script>
28</head>
29<body>
30    <form id="form1" runat="server">
31    <div>
32    
33    </div>
34        <table>
35            <tr>
36                <td style="width: 100px">
37                </td>
38                <td style="width: 100px">
39                    <asp:Label ID="lblTitle" runat="server" Text="多 文 件 上 传" Width="240px"></asp:Label></td>
40                <td style="width: 100px">
41                </td>
42            </tr>
43            <tr>
44                <td style="width: 100px">
45                </td>
46                <td style="width: 100px">
47                    <asp:FileUpload ID="FileUpload1" runat="server" Width="460px" /></td>
48                <td style="width: 100px">
49                </td>
50            </tr>
51            <tr>
52                <td style="width: 100px">
53                </td>
54                <td style="width: 100px">
55                    <asp:FileUpload ID="FileUpload2" runat="server" Width="460px" /></td>
56                <td style="width: 100px">
57                </td>
58            </tr>
59            <tr>
60                <td style="width: 100px; height: 21px">
61                </td>
62                <td style="width: 100px; height: 21px">
63                    <asp:FileUpload ID="FileUpload3" runat="server" Width="460px" /></td>
64                <td style="width: 100px; height: 21px">
65                    <asp:Button ID="btnupload" runat="server" OnClick="btnupload_Click" Text="全部上传它" /></td>
66            </tr>
67        </table>
68    </form>
69</body>
70</html>
71
posted @ 2008-02-27 13:43  阳光追梦  阅读(213)  评论(0编辑  收藏  举报
/*快速评论*/ #div_digg { position: fixed; bottom: 10px; right: 15px; border: 2px solid #ECD7B1; padding: 10px; width: 140px; background-color: #fff; border-radius: 5px 5px 5px 5px !important; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); } /** 不知道为什么页面加载完成时还读不到div_digg。可能也是动态生成的。 所以这里只能用定时器 不断的读取,当读取到了再给它动态添加快捷按钮 **/ //自定义 定时器[当元素加载完成是执行回调函数] function customTimer(inpId,fn) { if ($(inpId).length) { fn(); } else { var intervalId = setInterval(function () { if ($(inpId).length) { //如果存在了 clearInterval(intervalId); // 则关闭定时器 customTimer(inpId,fn); //执行自身 } }, 100); } } //页面加载完成是执行 $(function () { customTimer("#div_digg", function () { var div_html = "
\ 关注\  | \ 顶部\  | \ 评论\
"; $("#div_digg").append(div_html); //tbCommentBody }); });