我的需要是客户端在本地目录中有一组文件需要上传,系统需要对每个文件进行上传,难道要客户一个文件一个文件的选择,然后分别上传吗?那效率太低了吧。有什么办法可以批量上传?各位有办法的帮帮我。

解决方案 »

  1.   

    可以多个上传 但是必须建立多个FileUpload 控件,一个控件传一个
      

  2.   

    需要在页面显示多个FileUplooad控件吗?手工代码创建还是设计时创建?手工代码如何创建?请楼上赐教,谢谢!
      

  3.   

    我试了一下,那个fileupload控件无法设置.PostedFile .FileName属性,是只读的,我如何设置它,以循环上传多个文件?
      

  4.   

    fileupload的.PostedFile .FileName属性都是只读的,那你就读取它好了,把读取出来的路径放入数组中,循环上传到服务器,或者你选择第三方控件
      

  5.   

    用第三方空间吧,大批量上传附件AspNetUpload,从网上搜一下吧,AspNetUpload.dll
      

  6.   

    研究一下WebClient类所提供的方法。
      

  7.   

    现在很多网站采用的多附件上传的方式一般是:1、你添加一个文件,然后点击继续添加,然后再继续添加,最后一起上传。2、页面一打开就是5个FileUpload 控件,然后可以一次上传1-5个。如果你要上传多个,也可以去本地文件夹读取你的文件,然后批量上传。
      

  8.   

    不用  你直接上网上下载 flv文件上传。 
    里面有一个专门上传flv视频文件的控件,是别人先做好的可以批量上传,还可以看到进度条,很实用! 
      等等 一会我给你找找下载地址
      

  9.   

    http://www.cngr.cn/soft/net/sort0445/2009/2009032037621.html
    这个地址就是 你把代码下载下来以后改良一下就可以用了。很方便, 我就那么用的
      

  10.   

    上传压缩文件,上传后,在服务器端解压缩
    有个类:SharpZipLib
    你去搜索一下
      

  11.   

    好像.net自带也有解压缩的类库了
    System.IO.Compression
    但是我没用过
      

  12.   

    http://dotnet.aspx.cc/article/58ea3515-36f2-4fd9-ac89-eaf49f59816c/read.aspx
      

  13.   

    利用flash批量上传文件http://www.javaeye.com/topic/287810
      

  14.   

    SWFUpload--这个应该可以,可以批量上传图片,估计文件也应该可以吧
      

  15.   

    本人测试代码
    下载
    http://download.csdn.net/source/1862674<!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>
    <title>SWFUpload Demos - Application Demo</title>
    <link href="css/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="swfupload.js"></script>
    <script type="text/javascript" src="js/handlers.js"></script>
    <script type="text/javascript" src="js/swfupload.queue.js"></script>
    <script type="text/javascript">
    var swfu;
    window.onload = function () {
    swfu = new SWFUpload({
    // Backend Settings
    upload_url: "upload.aspx", // Relative to the SWF file or absolute
    post_params: {"PHPSESSID": "<%=Guid.NewGuid().ToString() %>"}, file_size_limit : "2MB", // 2MB
    file_types : "*.jpg;*.gif;*.png;",
    file_types_description : "图片(jpg,gif,png)",
    file_upload_limit : 100,

    custom_settings : {
    progressTarget : "fsUploadProgress",
    cancelButtonId : "btnCancel"
    }, // Event Handler Settings - these functions as defined in Handlers.js
    //  The handlers are not part of SWFUpload but are part of my website and control how
    //  my website reacts to the SWFUpload events.
    file_queued_handler : fileQueued,
    file_queue_error_handler : fileQueueError,
    file_dialog_complete_handler : fileDialogComplete,
    upload_start_handler : uploadStart,
    upload_progress_handler : uploadProgress,
    upload_error_handler : uploadError,
    upload_success_handler : uploadSuccess,
    upload_complete_handler : uploadComplete,

    // Button Settings
    button_image_url : "images/XPButtonNoText_65x22.png", // Relative to the SWF file
    button_placeholder_id : "spanButtonPlaceholder",
    button_width: 65,
    button_height: 22,
    button_text : '浏览',
    button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
    button_text_left_padding: 18,
    button_text_top_padding: 1,


    // Flash Settings
    flash_url : "swfupload.swf",

    // Debug Settings
    debug: false
    });
    }; </script>
    </head>
    <body>
    <div id="content">
    <form style="clear:both;padding-top:5px;padding-left:15px;" id="subForm">
    <span id="spanButtonPlaceholder"></span> &nbsp;
    <input id="startUpload" type="button" value="上传" onclick="imgUpoload()" disabled="disabled" style=" border:0px;width:65px;height:22px;background-image:url(swfupload/images/XPButtonNoText_65x22.png)" />
    &nbsp;
    <input id="btnComplete" type="button" value="完成" onclick="btmComplete()" disabled="disabled" style=" border:0px;width:65px;height:22px;background-image:url(swfupload/images/XPButtonNoText_65x22.png)" />
    &nbsp;
    <input id="btnCancel" type="button" value="取消" onclick="swfu.cancelQueue()" disabled="disabled" style=" border:0px;width:65px;height:22px;background-image:url(swfupload/images/XPButtonNoText_65x22.png)" />
    </form> <div class="fieldset flash" id="fsUploadProgress"><span class="legend">上传列表</span></div>
    <div id="thumbnails"></div>
    </div>
    </body>
    </html>using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    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 System.IO;public partial class upload : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (this.IsPostBack)
            {
                //foreach (HttpPostedFile a in Request.Files)
                //{
                //    a.SaveAs(Server.MapPath("~/Upload/") + a.FileName);
                //    Response.Write("FILEID:" + a.FileName);
                //}
                String fname = Request.Form["Filename"];
                FileInfo f = new FileInfo(fname);
                fname = Guid.NewGuid() + "." + f.Extension;
                String fullName = Server.MapPath("~/Upload/" + fname);
                Request.Files[0].SaveAs(fullName);
                Response.Write("FILEID:" + fname);
                //using (FileStream fs = new FileStream(fullName, FileMode.Create, FileAccess.Write))
                //{
                //    byte[] buffer = new byte[Request.InputStream.Length];
                //    int bts = Request.InputStream.Read(buffer, 0, buffer.Length);
                //    fs.Write(buffer, 0, bts);
                //    fs.Close();
                //    Response.Write("FILEID:" + fname);
                //}
            }
        }
    }
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    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 thumbnail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String file = Request.QueryString["id"]!=null?"Upload/"+Request.QueryString["id"]:String.Empty;
            file = Server.MapPath("~/"+file);
            if (System.IO.File.Exists(file))
            {
                Response.WriteFile(file);
            }
        }
    }