Save Image c #

1

I'm having the following error Generic GDI + error. when trying to save the image to a specific directory. I'm using code below.

string caminho=@"\.1.1.10\sistema";
            Stream myStream = null;
        OpenFileDialog abrir = new OpenFileDialog();
        abrir.Filter = "Images (*.BMP;*.JPG;*.GIF,*.PNG,*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF|" + "All files (*.*)|*.*";
        abrir.FilterIndex = 1;
        abrir.RestoreDirectory = true;
        if (abrir.ShowDialog() == DialogResult.OK)
        {
            if ((myStream = abrir.OpenFile()) != null)
                {
                   using (myStream)
                   {
                    Bitmap imagem = new Bitmap(abrir.FileName);//Pega o nome do arquivo escolhido
                    Bitmap igm = new Bitmap(imagem, 119, 110);//Padronisa o tamanho da imagaem ao picturebox
                    ImagemCamera.Image = igm;
                    ImagemCamera.Image.Save(caminho + "\Fotos" + "\" + Foto + "\" + FotoId + ".Png", System.Drawing.Imaging.ImageFormat.Png);
                 }
       }

Can anyone help me?

    
asked by anonymous 17.06.2015 / 19:40

1 answer

1

Well if you've got this far crazy for an answer. A few hours later I had the following conclusion. in the line where you save the picturebox, which in my case receives the name of ImageCamera , it would look like this

ImagemCamera.Image.Save(Path.GetFullPath(caminho) + "\Fotos" + "\" + Foto + "\" + FotoId + ".Png", System.Drawing.Imaging.ImageFormat.Png);
    
17.06.2015 / 22:04