Thursday, January 17, 2013

Read content of text file while uploading with out saving in server folder

  string InputFileText;
        long InputFileLength;
        UTF8Encoding encoder;
        byte[] btInputFile;
        InputFileText = string.Empty;
        InputFileLength = 0;
        encoder = new UTF8Encoding();
        InputFileLength = FileUpload1.PostedFile.InputStream.Length;
        btInputFile = new byte[InputFileLength];
        FileUpload1.PostedFile.InputStream.Seek(0, SeekOrigin.Begin);
        FileUpload1.PostedFile.InputStream.Read(btInputFile, 0, btInputFile.Length);
        InputFileText = encoder.GetString(btInputFile);


.......Happy Coding.......