孟子大哥给出了上传方法,同时我想多图片生成预览和显示,请大家帮忙!!

解决方案 »

  1.   

    //****后代码
     StringBuilder sb = new StringBuilder();
            StringBuilder strTemp = new StringBuilder();        int attCount = 0; string filePath = ""; 
            for (int i = 0; i < Request.Files.Count; i++)
            {
                if (Request.Files[i].ContentLength > 0) 
                  { 
                    filePath = Request.Files[i].FileName;
                    
                    sb.Append("Files" + attCount++ + ": " + filePath + "<br>");                Request.Files[0].SaveAs(Server.MapPath("../UpLoadFiles/Temp/") + filePath.Substring(filePath.LastIndexOf("\\") + 1));                //****删除最后一个","
                    //UpFiles.Value +=filePath.Substring(filePath.LastIndexOf("\\") + 1) + ",";
                    if (UpFiles.Value == "")
                    {
                        UpFiles.Value = Server.MapPath("../UpLoadFiles/Temp/") + filePath.Substring(filePath.LastIndexOf("\\") + 1);
                    }
                    else
                    {
                        UpFiles.Value += "," + Server.MapPath("../UpLoadFiles/Temp/") + filePath.Substring(filePath.LastIndexOf("\\") + 1);
                    }               }
            }        
            sb.Insert(0, "you upload " + attCount + " files.<br>"); Response.Write(sb.ToString());        BuliteTable = AppGloap.UpLoadFiles(UpFiles.Value);
    //****前台代码
     <script language="javascript">
         <!-- 
         
               function AddAttachments()
               {  
                   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)
               { 
                  document.getElementById('attAchments').deleteRow(index);
                  tb.rows.length > 0?document.getElementById('attach').innerText = "继续添加附件":document.getElementById('attach').innerText = "添加附件"; 
              }  
              
              function CtrlEnter()
              {
                 if(event.ctrlKey && event.keyCode==13)
                 {
                   alert("cccc");
                 }
              }
              
              //****显示提示
              function On_Windows()
              {
                 if(form1.WindowsMessageBox.value!="")
                 {
                     //****给出提示
                     alert(form1.WindowsMessageBox.value);
                     
                     form1.WindowsMessageBox.value="";
                 }
              }
              
              function DispalyUpLoadFilePath(varFilePath)
              {
                    form1.UpLoadFilePath.value=varFilePath;
                    
              }
              
              //****不显示右键
              
          //-->
        </script></head>
    <body onload="On_Windows();">
        <form id="form1" enctype="multipart/form-data" runat="server">
            <div>
                <table id="attAchments" align="center">
                    <tr>
                        <td>
                            <img src="icoAddFl.gif" border="0" algin="absmiddle">
                            <a id="attach" style="font-family: 宋体; font-size: 9pt;" title="如果您要发送多个附件,您只需多次点击“继续添加附件”即可, 要注意附件总量不能超过发送限制的大小。"
                                onclick="AddAttachments();" href="javascript:;" name="attach">添加附件</a>
                        </td>
                    </tr>
                </table>
                <asp:Button ID="btnSend" runat="server" Text=" 上传 " OnClick="btnSend_Click"></asp:Button>
                <input id="butok" onkeyup="CtrlEnter();" value="Ctrl And Enter" type="button" />
                <input id="UpFiles" runat="server" type="hidden" />
                <div align="center">
                    <%=BuliteTable%>
                    &nbsp;</div>
                <input id="UpLoadFilePath" runat="server" type="hidden" />
                <input id="WindowsMessageBox" runat="server" type="hidden" />
            </div>
        </form>
    </body>
    </html>
      

  2.   

    http://msdn.microsoft.com/vstudio/express/vwd/starterkit/#personal
    下载Personal Web Site。这个就是那个示例