选择一本地的图片文件夹,选里面的图片,然后就可以按图片名称批量添加到数据库里,一张图一个记录。
最好像QQ相册那种带预览和进度条的。各位高手帮帮忙!!!!!!
有源码的发到邮箱 [email protected]谢谢!

解决方案 »

  1.   

    Discuz!NT里有一个批量上传的,自己去研究吧,反正人家也是有源码的
      

  2.   

    <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
    参考