如题,大侠们出来接分

解决方案 »

  1.   

            HttpFileCollection hfc = Request.Files;
            if (hfc.Count > 0)//有上传文件
            {
                HttpPostedFile hpf = hfc[0];//第一个上传文件
                hpf.SaveAs(Server.MapPath("/file/aaaaa.jpg"));//保存到服务器物理路径
                //保存路径到数据库            
            }
      

  2.   

    asp.net上传图片保存到数据库的代码
      

  3.   

    将数据库中的字段设置为image字段,然后将图片转化为二进制流存入数据库
    可以到这里提问
      

  4.   

    if (FileUpload1.HasFile)
    {
    string ServerPath = Server.MapPath("~/Img/") + ImgName;
    FileUpload1.PostedFile.SaveAs(ServerPath);
    using(SqlConnection con = new SqlConnection(""))
    {
      con.Open();
      SqlCommand com = new SqlCommand("insert into test(image) values('" + ImgName + "')", con);
    }}显示Image1.ImageUrl=ResolveUrl("~/img/")+dr["image"].ToString());
      

  5.   

    图片放到数据库里面, 一种方式就是上面说的那种, 直接上传图片到服务器,然后存路径或者将数据库里面的字段 设置为image, text ,ntext  不定的二进制或者字符型数据 这样子就可以直接保存了。