Friday, September 7, 2007

Upload a file in Window application


if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                FileInfo f = new FileInfo(openFileDialog1.FileName);
                string[] fName;
                fName = openFileDialog1.FileName.Split(new char[] {'\\'} );

                f.CopyTo("C:\\Bharathi\\" + fName[fName.Length-1]);

                FileStream fs = new FileStream("C:\\Bharathi\\" + fName[fName.Length - 1], FileMode.Open);
                StreamReader sr = new StreamReader(fs);

                MessageBox.Show(sr.ReadToEnd());

               
                //System.IO.File.ReadAllBytes(openFileDialog1.FileName);
            }

2 comments:

Anonymous said...

Gostei muito desse post e seu blog é muito interessante, vou passar por aqui sempre =) Depois dá uma passada lá no meu site, que é sobre o CresceNet, espero que goste. O endereço dele é http://www.provedorcrescenet.com . Um abraço.

Anonymous said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Smartphone, I hope you enjoy. The address is http://smartphone-brasil.blogspot.com. A hug.