1
Answer

how to save image in project folder and name save to the da

how to save image in project folder and name save to the database 
any body can help me
my code is that i am bagginer
private void Btn_Browse_Click(object sender, EventArgs e)
{
OpenFileDialog op = new OpenFileDialog();
op.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (op.ShowDialog() == DialogResult.OK)
{
try
{
PictureBox1.Image = new Bitmap(op.FileName);
lbl_image.Text = op.FileName;
string appPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "~Image"; // <---
if (Directory.Exists(appPath) == false) // <---
{ // <---
Directory.CreateDirectory(appPath); // <---
} // <---
string iName = op.FileName; // <---
string filepath = op.FileName; // <---
File.Copy(filepath, appPath + iName); // <---
PictureBox1.Image = new Bitmap(op.OpenFile());
}
catch (Exception ex)
{
throw ex;
}
 

Answers (1)