سلام ، اول بررسی کنید ببینید اگر فایلی با نام مشابه وجود داشت حذف کنید و بعد فایل را با همون نام ذخیره کنید :
private void saveImage(PictureBox pPictureBox,string pFilePath)
{
Bitmap bmp1 = new Bitmap(pPictureBox.Image);
if (System.IO.File.Exists(pFilePath))
System.IO.File.Delete(pFilePath);
bmp1.Save(pFilePath, System.Drawing.Imaging.ImageFormat.Jpeg);
// Dispose of the image files.
bmp1.Dispose();
}
استفاده :
private void button1_Click(object sender, EventArgs e)
{
this.saveImage(this.pictureBox1, "c:\\SomeFile.jpg");
}