当前位置:编程学习 > C#/ASP.NET >>

能框选多个文件,同时上传,上传中有进度显示,这个是怎么作到的?

能框选多个文件,同时上传,上传中有进度显示,这个是怎么作到的?


--------------------编程问答-------------------- 框选多个文件?微软自己的控件好像不行把 进度是根据你上传文件的总大小来计算的 --------------------编程问答-------------------- swfupload --------------------编程问答-------------------- jquery.uploadify --------------------编程问答--------------------
引用 3 楼 bakhpl 的回复:
jquery.uploadify

这个也许楼猪也有用了 --------------------编程问答--------------------
<body> 
    <form id="form1" runat="server"> 
    <div> 
    <table style="width: 343px"> 
            <tr> 
                <td style="width: 100px"> 
                    多文件上传</td> 
                <td style="width: 100px"> 
                </td> 
            </tr> 
            <tr> 
                <td style="width: 100px"> 
                    <asp:FileUpload ID="FileUpload1" runat="server" Width="475px" /> 
                    </td> 
                <td style="width: 100px"> 
                    </td> 
            </tr> 
            <tr> 
                <td style="width: 100px"> 
                    <asp:FileUpload ID="FileUpload2" runat="server" Width="475px" /></td> 
                <td style="width: 100px"> 
                </td> 
            </tr> 
            <tr> 
                <td style="width: 100px"> 
                    <asp:FileUpload ID="FileUpload3" runat="server" Width="475px" /></td> 
                <td style="width: 100px"> 
                </td> 
            </tr> 
            <tr> 
                <td style="width: 100px"> 
                    <asp:Button ID="bt_upload" runat="server" OnClick="bt_upload_Click" Text="一起上传" /> 
                    <asp:Label ID="lb_info" runat="server" ForeColor="Red" Width="448px"></asp:Label></td> 
                <td style="width: 100px"> 
                </td> 
            </tr> 
        </table> 
    </div> 
    </form> 
</body>


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; 

public partial class _Default : System.Web.UI.Page  

    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void bt_upload_Click(object sender, EventArgs e) 
    { 
        if (FileUpload1.PostedFile.FileName == "" && FileUpload2.PostedFile.FileName == "" && FileUpload3.PostedFile.FileName == "") 
        { 
            this.lb_info.Text = "请选择文件!"; 
        } 
        else 
        { 
            HttpFileCollection myfiles = Request.Files; 
            for (int i = 0; i < myfiles.Count; i++) 
            { 
                HttpPostedFile mypost = myfiles[i]; 
                try 
                { 
                    if (mypost.ContentLength > 0) 
                    { 
                        string filepath = mypost.FileName;//C:\Documents and Settings\Administrator\My Documents\My Pictures\20022775_m.jpg 
                        string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1);//20022775_m.jpg 
                        string serverpath = Server.MapPath("~/images/") + filename;//C:\Inetpub\wwwroot\WebSite2\images\20022775_m.jpg 
                        mypost.SaveAs(serverpath); 
                        this.lb_info.Text = "上传成功!"; 
                    } 
                } 
                catch (Exception ex) 
                { 
                    this.lb_info.Text = "上传发生错误!原因:" + ex.Message.ToString(); 
                } 
            } 
        } 
    } 
}


jquery 批量上传插件Uploadify
参考 --------------------编程问答--------------------
引用 5 楼 wxr0323 的回复:
HTML code
<body> 
    <form id="form1" runat="server"> 
    <div> 
    <table style="width: 343px"> 
            <tr> 
                <td style="width: 100px"> 
                    多文件上传</td> 
    ……

我算是发现了 这个已经成为前辈的回复内容了 复制 粘贴的把- - 哈哈 --------------------编程问答--------------------
引用 2 楼 xujun5031 的回复:
swfupload

up↑ --------------------编程问答-------------------- 头一次听你这么描述“批量上传”
--------------------编程问答--------------------
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,