private void BrwseBtn_Click(object sender, EventArgs e) { openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\"; openFileDialog1.Filter = "All files (*.*)|*.*"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { //PictureBox PictureBox1 = new PictureBox(); pictureBox1.Image = new Bitmap(openFileDialog1.FileName); //file preview this.Controls.Add(pictureBox1); } catch (Exception ex) { MessageBox.Show("Error loading image" + ex.Message); } } } private void UploadBtn_Click(object sender, EventArgs e) { // trying to save the file in C:\ drive string fileName = @"C:\\"; this.UploadBtn.Image.Save(fileName); MessageBox.Show("Success"); // let say i need to save not only image, i need to save images and docs as well }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)