private String imageUpload()
        {
            string imagepath = studentPB.ImageLocation.ToString();
            //string picname = imagepath.Substring(imagepath.LastIndexOf('\\'));
            string extension = System.IO.Path.GetExtension(openFileDialog1.FileName);
            //MessageBox.Show(extension);
            //string picname = pictureBox2.;
            //string picname = "\\".ToString() + mobileTB.Text + extension;
            string picname = mobileNoL.Text + extension;

            MessageBox.Show("The photo has been uploaded. Now the picture will be resized. Image name:" + picname, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Basic.image_processing aa = new Basic.image_processing();

            Image scaledImage = aa.ScaleByPercent(studentPB.Image);

            studentPB.Image = scaledImage;

            // string path = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("bin"));
            string path     = Application.StartupPath;
            Bitmap imgImage = new Bitmap(studentPB.Image); //Create an object of Bitmap class/

            //string type = imgImage.GetPropertyItem(1).ToString();
            //MessageBox.Show(type);



            imgImage.Save(path + "\\images\\" + picname);


            return(picname); //this file name can be accesible to your save button click event.
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_frameSource == null)
            {
                return;
            }
            //string path = Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("images"));
            //string path = Application.StartupPath;
            string path = Environment.CurrentDirectory;

            path = Path.Combine(path, "images");
            bool IsExists = System.IO.Directory.Exists(path);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(path);
            }

            Bitmap current  = (Bitmap)_latestFrame.Clone();
            var    fileName = Path.Combine(path, mobileNo + ".jpg");

            current.Save(fileName);
            //MessageBox.Show(fileName);
            //using (SaveFileDialog sfd = new SaveFileDialog())
            //{


            //    sfd.InitialDirectory = path;
            //    sfd.FileName = mobileNo;
            //    sfd.Filter = "*.jpg|*.jpg";
            //    if (sfd.ShowDialog() == DialogResult.OK)
            //    {

            //        current.Save(sfd.FileName);
            //        MessageBox.Show("Image upload is complete. Now the image will be resized. image name:" + mobileNoL.Text + ".jpg");
            //    }
            //}

            current.Dispose();
            MessageBox.Show("Image upload is complete. Now the image will be resized. image name:" + mobileNoL.Text + ".jpg");

            // MessageBox.Show(path);
            //for size small

            pictureBoxDisplay.ImageLocation = fileName;

            MessageBox.Show(pictureBoxDisplay.ImageLocation);
            //nameL.Text = pictureBoxDisplay.ImageLocation;
            Basic.image_processing aa = new Basic.image_processing();

            Image scaledImage = aa.ScaleByPercent(pictureBoxDisplay.Image);

            pictureBoxDisplay.Image = scaledImage;

            Bitmap imgImage = new Bitmap(pictureBoxDisplay.Image); //Create an object of Bitmap class/

            //string type = imgImage.GetPropertyItem(1).ToString();
            //MessageBox.Show(type);
            imgImage.Save(fileName);
        }