string housr = DateTime.Now.Hour.ToString();
string min = DateTime.Now.Minute.ToString();
string second = DateTime.Now.Second.ToString();
temp = housr + min + second ;
opfdPhoto.InitialDirectory = Application.StartupPath;
opfdPhoto.FileName = "";
this.opfdPhoto.Title = "選擇相片";
opfdPhoto.Filter = "圖片文件(*.jpg;*.bmp;*.gif)|*.jpg;*.bmp;*.gif|所有文件(*.*)|*.*";
if (opfdPhoto.ShowDialog() == DialogResult.OK)
{
this.lblPhoto.Text =opfdPhoto.FileName;
this.ptrPhoto.Image = Image.FromFile(this.opfdPhoto.FileName);
}
string fileName
;
int pos = this.opfdPhoto.FileName.LastIndexOf("\\");
fileName = this.lblPhoto.Text.Substring(pos + 1, this.lblPhoto.Text.Length - pos - 1);
//fileName = this.opfdPhoto.FileName.Substring(pos + 1, this.opfdPhoto.FileName.Length - pos - 1);
//MessageBox.Show(fileName);
//int ps = this.opfdPhoto.FileName.LastIndexOf(".");
FileInfo fi = new FileInfo(this.lblPhoto.Text);
fi.CopyTo(Application.StartupPath + @"\StudentPhoto\" + fileName, true);
Environment.CurrentDirectory = Application.StartupPath;