只能上传文件,数据库数据未被修改

解决方案 »

  1.   

    Request就可以获取表单内容,查一下SQL
      

  2.   

     enctype ="multipart/form-data"
    好像是这个的问题,设成这个就取不了表单的值
      

  3.   

    <form id="form1" runat="server" enctype="multipart/form-data">
        <div>
            <input id="File1" type="file"  name="upFiles" />
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        </div>
    </form>
    protected void Button1_Click(object sender, EventArgs e)
        {
            HttpPostedFile postFiles = Request.Files[0];
            string fileName = postFiles.FileName;
            Response.Write(fileName);
        }
      

  4.   

    <%@ Page Language="C#" Debug="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
      
      protected void Page_Load(object sender, EventArgs e)
      {
        if (Request.RequestType == "POST")
        {
          HttpPostedFile postedFile = Request.Files["File1"];
          string fileName;
          fileName = System.IO.Path.GetFileName(postedFile.FileName);
          postedFile.SaveAs(Request.MapPath("~/") + fileName);      Response.Write("输入的内容 = " + Request.Form["Title"]);
          //插入数据库即可
        }
      }  
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      <title></title>
    </head>
    <body>
      <form method="post" enctype="multipart/form-data">
      <input name="File1" type="file" />
      <input name="Title" value="文字" />
      <input id="Submit1" type="submit" value="submit" />
      </form>
    </body>
    </html>
      

  5.   

    file 控件  
    private string GetTRStrFile(string aa, string bb, string cc, int num)
        {        string returnString = "";
            returnString += "<td class=\"style5\">";
            returnString += "<span lang=\"zh-cn\" id=\"span" + aa + "\">" + bb + "</span></td>";
            returnString += "<td align=\"left\" onmouseover=\"this.className='t_rowh'\" onmouseout=\"this.className='t_row'\"style=\"height: 16px\" colspan=\"3\">";
            returnString += "<input id=\"input" + aa + "\" type=\"file\" name=resume" + num + " value=\"" + cc + "\" style=\"width:388px\" /></td>";
            return returnString;    } 提交表单按钮
    protected void BtnSubmit_Click(object sender, EventArgs e)
        { 
            ArrayList resume = new ArrayList();
            while (i > 0)
            {
                if (Request.Form["resume" + i] != null)
                {
                    resume.Add(Request.Form["resume" + i]);
                    i++;
                }
                else
                {
                    break;
                }
            }
            string[] array = (string[])resume.ToArray(Type.GetType("System.String"));
            int n = DataAccess.Repeat.UpdateRepeatTable(tablename, array, tableide);
    }
    我知道 filename 就是文件名 可是怎么放到数组里呢