asp.net上传控件在UpdatePanel下使用多个会有问题可以通过iframe或者自己写ajax实现

解决方案 »

  1.   

    http://zzk.cnblogs.com/s?w=%E6%97%A0%E5%88%B7%E6%96%B0%E4%B8%8A%E4%BC%A0&t=
      

  2.   

    我们QQ群里面有人实现了,
    欢迎加入我们QQ群,大家一块学习QQ群号:2976157
      

  3.   

    通过iframe或者ajax实现 
    搜一下很多的
      

  4.   

    iframe。一直用这个虽然假的,但能做的看不出来是假的,就当真的了吧~
      

  5.   

    对于不懂ajax的人来说iframe是最好的选择,,哪果懂ajax的话,,,应该不会在这里问了
      

  6.   

    http://www.cnblogs.com/huacn/archive/2007/07/16/ajax_upload_javascript_js_wushuaxing_jquery.html
      

  7.   

    http://www.cnblogs.com/armywin/articles/1279971.html
    http://www.cnblogs.com/cloudgamer/archive/2008/12/31/1314766.html
    http://www.cnblogs.com/jembai/articles/1281266.html
      

  8.   

    创建iframe,伪装来实现.
    要代码留个邮箱
      

  9.   

    private Boolean SaveImages()
        {        HttpFileCollection files = HttpContext.Current.Request.Files;
            System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
            strMsg.Append("上传的文件分别是:<hr color=red>");
            try
            {
                for (int iFile = 0; iFile < files.Count; iFile++)
                {
                    HttpPostedFile postedFile = files[iFile];
                    string fileName, fileExtension, file_id;
                    int year = System.DateTime.Now.Year;
                    int month = System.DateTime.Now.Month;
                    int day = System.DateTime.Now.Day;
                    int hour = System.DateTime.Now.Hour;
                    int minute = System.DateTime.Now.Minute;
                    int second = System.DateTime.Now.Second;
                    int millisecond = System.DateTime.Now.Millisecond;
                    //string my_file_id = year.ToString() + month.ToString() + day.ToString() + hour.ToString() + minute.ToString() + second.ToString() + millisecond.ToString() + iFile.ToString();                fileName = System.IO.Path.GetFileName(postedFile.FileName);
                    fileExtension = System.IO.Path.GetExtension(fileName);
                    file_id = fileName;
                    if (fileName != "")
                    {
                        fileExtension = System.IO.Path.GetExtension(fileName);
                        strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "<br>");
                        strMsg.Append("客户端文件地址:" + postedFile.FileName + "<br>");
                        strMsg.Append("上传文件的文件名:" + file_id + "<br>");
                        strMsg.Append("上传文件的扩展名:" + fileExtension + "<br><hr>");
                        postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("upload/") + file_id);
                    }
                }
                strStatus.Text = strMsg.ToString();
                return true;
            }
            catch (System.Exception Ex)
            {
                strStatus.Text = Ex.Message;
                return false;
            }
        }    protected void UploadButton_Click(object sender, EventArgs e)
        {
            Boolean bl = SaveImages();
            if (bl)
            {
                adminDataBase db = new adminDataBase();
                int l = db.Log(Session["adminName"].ToString(), "上传文件");
                Response.Write("<script>alert('上传成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('上传失败!')</script>");
            }
        }
      

  10.   

    using System.Web.UI.HtmlControls;
       这个引用。。<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="uploadIT.aspx.cs" Inherits="_uploadIT" %><!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>多文件上传</title>
         <script language="javascript">
         function addFile()
         {
         var str = '<INPUT type="file" size="50" NAME="File">'
         document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str)
         }
         </script>
       </head>
       <body>
         <form id="form1" method="post" runat="server" enctype="multipart/form-data">
           <div align="center">
             <h3>多文件上传</h3>
             <P id="MyFile"><input type="file" size="50" NAME="File"></P>
             <P>
               <input type="button" value="增加(Add)" onclick="addFile()">
               <input onclick="this.form.reset()" type="button" value="重置(ReSet)">
               <asp:Button Runat="server" Text="开始上传" ID="UploadButton" OnClick="UploadButton_Click"></asp:Button>
             </P>
             <P>
             <asp:Label id="strStatus" runat="server" Font-Names="宋体" Font-Bold="True" Font-Size="9pt" 
               Width="500px" BorderStyle="None" BorderColor="White"></asp:Label>
             </P>
           </div>
         </form>
       </body>
    </html>