How to save image in a project folder in C# winforms [closed]

Faithwwz

New Member
I have make a folder of name StdImage and I want to upload a picture in that folder through a picture box.Could you provide code for that?As I am doing registration of a student with his photo, I need to get a the picture of this certain student.\[code\]private void BtnUpload_Click(object sender, EventArgs e){ //string filename = System.Windows.Forms.Application.StartupPath + "\\StudentImages\\" + pcbStudentImage.Image; //pcbStudentImage.Image.Dispose(); //pcbStudentImage.Image.Save(filename + pcbStudentImage.Image, ImageFormat.Jpeg); //MessageBox.Show("Image uploaded.", "Message"); Directory.CreateDirectory("StdImage"); string path = Path.Combine(Environment.CurrentDirectory, @"StdImage\image.jpg"); pcbStudentImage.Image.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg); MessageBox.Show("Image saved.", "Message"); }\[/code\]
 
Back
Top