FileStream fs = File.OpenRead(log);
                byte[] by = new byte[fs.Length];
                fs.Position = 0;
                fs.Read(by, 0,(int) fs.Length);这个是写进数据库的代码   FileStream fs = File.OpenRead(log);
                byte[] by = new byte[fs.Length];
                fs.Position = 0;
                fs.Read(by, 0,(int) fs.Length);这个是读取图片的代码
小弟现在使用 folderBrowserDialog1 来保存图片
 pictureBox1.Image.Save(i.ToString());下载下来的图片显示不出 
高手请教!

解决方案 »

  1.   

    错误代码在System.Drawing.Image.Save(String Filename,ImageCoderInfo encoder,EncoderParameters
    encoderParams)
    System.Drawing.Image.Save(String Filename,ImageFormat fromat)
    System.Drawing.Image.Save(String Filename)我在想 是不是文件流的关系 不能正确保存数据
      

  2.   

    pictureBox1.Image.Save(i.ToString(), System.Drawing.Imaging.ImageFormat.Jpeg);
      

  3.   

     this.folderBrowserDialog1.RootFolder = Environment.SpecialFolder.Desktop;
                this.folderBrowserDialog1.SelectedPath = @"E:\浏览器";
                this.folderBrowserDialog1.ShowNewFolderButton = true;
                this.folderBrowserDialog1.Description = "选择文件夹";
                if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
                    Random rd = new Random(100);
                    int i = rd.Next(1, 9999);
                    try
                    {                    pictureBox1.Image.Save(i.ToString(), System.Drawing.Imaging.ImageFormat.Jpeg);
                       
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.StackTrace);
                    }
                }在Save 的时候就报错  错误上面我贴出来了。大侠看看
      

  4.   

    //二进制转换为文件
    private void DownLoadFile(string sFilePath, byte[] FileBytes)
            {
                FileStream fs = new FileStream(sFilePath, FileMode.CreateNew);
                BinaryWriter bw = new BinaryWriter(fs, Encoding.GetEncoding("gb2312"));
                bw.Write(FileBytes, 0, FileBytes.Length);
                bw.Close();
                fs.Close();
            }