6

I am beginner in c#. In my project, if I do try the below code to save a copy of image, it is giving error "A generic error occurred in GDI+." . I have gone through this link, but I have no knowledge of what is he saying.

I tried the below code:

 Bitmap bmpLarge = new Bitmap(ofdFlagsLarge.FileName);
 bmpLarge.Save(@"\..\..\" + strLargePath);               /* ERROR */

Can someone please assist me to save a image from the local PC directory itself to other directory on the same machine..

Community
  • 1
  • 1
Mr_Green
  • 40,727
  • 45
  • 159
  • 271

1 Answers1

27

You just want to copy a file?

Why not use:

System.IO.File.Copy("source", "destination");

http://msdn.microsoft.com/en-us/library/c6cfw35a.aspx

middelpat
  • 2,555
  • 1
  • 20
  • 29
  • 3
    Adding to @middelpat's answer- System.IO.File.Copy("source", "destination",true); This will overwrite if there is any file with the same name. – JustCurious Jun 07 '18 at 21:22