用asp.net 实现类似邮件附件上传的效果  
可以选多个文件 不满意可以删除一两个 点击发送 才吧文件上传到服务器上  用FileUpload只能实现单文件上传 如果多文件上传需要多个FileUpload控件 这样感觉效果 不是很号
所以 想 弄个 类似QQ邮箱的多附件上传的 样子 但是不知道 怎么弄希望 各位大虾 能帮一下 小弟!

解决方案 »

  1.   

    QQ邮箱的多附件上传,靠的是本地部署一个ActiveX控件。
      

  2.   

    1L的JQurey不是太懂,2L能不能具体点……
      

  3.   


    怎么引用到.net的项目里?什么位置放,具体点谢谢!
      

  4.   

    页面:
    js:
     function AddAttachments()
                {    
                     if(num > 5)
                     {
                        alert("最多只能上传五个附件!");
                        return;
                     }                
                     
                     num ++;
                        
                     document.getElementById('attach').innerText = "继续添加附件";     
                     tb = document.getElementById('attAchments');
                     newRow = tb.insertRow();
                     newRow.insertCell().innerHTML = "<input name='File' size='50' type='file'>&nbsp;&nbsp;<input type=button value='删除' onclick='delFile(this.parentElement.parentElement.rowIndex)'>";         
                }
                function delFile(index)
                {    
                     num --;
                     document.getElementById('attAchments').deleteRow(index);
                     tb.rows.length > 0?document.getElementById('attach').innerText = "继续添加附件":document.getElementById('attach').innerText = "添加附件"; 
                }    html <table id="attAchments">
                            </table>
                            <a id="attach" style="font-family: 宋体; font-size: 9pt;" title="如果您要发送多个附件,您只需多次点击“继续添加附件”即可, 要注意附件单个大小不要超过50M。" onclick="AddAttachments();" href="javascript:;" name="attach">添加附件</a>
                           <asp:TextBox ID="TextBox1" Runat="server" Font-Bold="true"  class="rece4" />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="btnSend" runat="server" Text=" 上传 " OnClick="btnSend_Click"></asp:Button>后台:
      protected void btnSend_Click(object sender, EventArgs e)
            {            StringBuilder sb = new StringBuilder();            int attCount = 0;            string filePath = "";            string strPath = "";            string Name = "";
                string newName = "";            for (int i = 0; i < Request.Files.Count; i++)
                {                if (Request.Files[i].ContentLength > 0)
                    {                    filePath = Request.Files[i].FileName;                    FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read);                    double d = file.Length / 1024 / 1024;                    sb.Append("Files" + attCount++ + ": " + filePath + "<br>");                    Name = getName(filePath);
                        newName = getNewName(Name);
                        strPath = Server.MapPath("~/mailsfile/") + filePath.Substring(filePath.LastIndexOf("\\") + 1).Replace(Name, newName);
                      
                        //保存文件
                        Request.Files[0].SaveAs(strPath);                 
                    }            }            //sb.Insert(0, "you upload " + attCount + " files.<br>"); Response.Write(sb.ToString());        }
      

  5.   


                        Name = getName(filePath);
                        newName = getNewName(Name);
                        strPath = Server.MapPath("~/mailsfile/") + filePath.Substring(filePath.LastIndexOf("\\") + 1).Replace(Name, newName);
                      
                        //保存文件
    6楼的getNewName和getName的方法没有写啊期待补全