直接讀取上傳文字檔

摘要:直接讀取上傳文字檔

目的把上傳的文字檔直接讀裡面的資料,不過資料到檔案系統了..

 


                byte[] byt = new byte[fu_keyfile.PostedFile.ContentLength];
                fu_keyfile.PostedFile.InputStream.Read(byt, 0, fu_keyfile.PostedFile.ContentLength);

                System.Text.Encoding enc = System.Text.Encoding.GetEncoding(950);
                //System.Text.Encoding enc = System.Text.Encoding.UTF8;
                //System.Text.Encoding enc = System.Text.Encoding.ASCII;
                Response.Write(string.Format("<pre>{0}</pre>",enc.GetString(byt)));