希望你喜欢

导航

FileStream读取文件代码

//文件完整路径
        string fileName = this.FileUpload1.PostedFile.FileName;
        //创建文件流
        FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
        //创建byte数字
        Byte[] bytes = new Byte[fs.Length];
        //写入缓冲区
        fs.Read(bytes, 0, Convert.ToInt32(fs.Length));
        fs.Close();

posted on 2011-04-19 21:44  希望你喜欢  阅读(386)  评论(0编辑  收藏  举报