rt  这是最好的方案不行的话 根据图片名称上传也行  不要用fileupload控件  我这是后台程序 不需要人工添加帮帮忙!!

解决方案 »

  1.   

    http://www.cnblogs.com/phone/archive/2010/09/14/1825850.html
      

  2.   

    你既然知道连接,那么可以webclient先下载,然后将数据流提交到数据库(http://www.cnblogs.com/tuyile006/archive/2007/01/08/614718.html
      

  3.   

    发错了  是二楼 
    4楼public void imgToDB(string sql)
            {   //参数sql中要求保存的imge变量名称为@images
                //调用方法如:imgToDB("update UserPhoto set Photo=@images where UserNo='" + temp + "'");
                FileStream fs = File.OpenRead(t_photo.Text);
                byte[] imageb = new byte[fs.Length];
                fs.Read(imageb, 0, imageb.Length);
                fs.Close();
                SqlCommand com3 = new SqlCommand (sql,con);
                com3.Parameters.Add("@images", SqlDbType.Image).Value = imageb;
                if (com3.Connection.State == ConnectionState.Closed)
                    com3.Connection.Open();
                try
                {
                    com3.ExecuteNonQuery();
                }
                catch
                { }
                finally
                { com3.Connection.Close(); }
            } 
    imge变量 是路径么
      

  4.   

    以解决了 不过用的是本地文件夹路径  网页图片路径的话 应该是差不多的
       String filepath;
            filepath = "F:\\SLmanager\\Web\\picture\\" + rename + ".png";
            FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
            //利用新传来的路径实例化一个FileStream对象
            int filelength = Convert.ToInt32(fs.Length);
             string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1);
            //文件名不带后缀名(后面也没有用到<可删>)
            string name = filename.Substring(0, filename.Length - 4);
             byte[] sf = new byte[filelength];  //定义byte型数组