OpenFileDialog fop = new OpenFileDialog(); //fop.InitialDirectory = @"C:\Users\ODYSSEY\Downloads\Documents\Panorama\Resources\"; fop.Filter = "[JPG,JPEG]|*.jpg"; if (fop.ShowDialog() == DialogResult.OK) { FileStream FS = new FileStream(@fop.FileName, FileMode.Open, FileAccess.Read); byte[] img = new byte[FS.Length]; FS.Read(img, 0, Convert.ToInt32(FS.Length)); if (con.State == ConnectionState.Closed) con.Open(); SqlCommand cmd = new SqlCommand("SaveImage", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@img", SqlDbType.Image).Value = img; cmd.Parameters.Add("@imgname", SqlDbType.VarChar).Value = @fop.FileName; cmd.ExecuteNonQuery();
Path.GetFilename()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)