Browse an image file and upload into database

Aug 14 2009 11:53 AM
Hi.....

I need a help again...........

I have a one TextBox and two Buttons in my application. One is for Browse and other is for Upload.
I want to browse an image file using Browse button (then the path file will appear in the text box) and upload that file into database.

Then i want to load this stored button into PictureBox using another button called View.

I found below code for browsing.....please support me to do the rest.

    private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fdlg = new OpenFileDialog();
            fdlg.Title = "Open File";
            fdlg.InitialDirectory = @"c:\";
            fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
            fdlg.FilterIndex = 2;
            fdlg.RestoreDirectory = true;
            if (fdlg.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = fdlg.FileName;
            }
        }


If u could please give me a hand to do this.

Thanks,
CharithMax

Answers (7)