private void SavePahtImage() { string sPath = $"BookImage/{bookId}"; string localFile = pictureBox1.Tag.ToString(); string sExt = localFile.Substring(localFile.LastIndexOf(".")); string newFileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + sExt; string destFileName = Path.Combine(sPath, newFileName); textBox2.Text = destFileName; DirectoryInfo dir = new DirectoryInfo(sPath); if (!dir.Exists) { dir.Create(); } File.Copy(localFile, destFileName, true); BookDB db = new BookDB(); bool bResult = db.AddBookImage(bookId, destFileName); if (bResult) { MessageBox.Show("이미지 추가가 완료되었습니다."); //textBox2.Text = newFileName; } else { MessageBox.Show("이미지 저장에 실패했습니다. 다시 시도하여 주십시오."); } }