文件转换为流,流通过字节转换为文件

StreamReader sr = new StreamReader(Server.MapPath("~/images/LYF.jpg"));
        byte[] bytes=new byte[sr.BaseStream.Length];
        sr.BaseStream.Read(bytes, 0,(int)sr.BaseStream.Length);
        //Response.Write(bytes.Length.ToString());
        FileInfo fileinfo = new FileInfo(Server.MapPath("~/images/lxx.jpg"));
        FileStream fs=fileinfo.Create();
        fs.Write(bytes, 0, bytes.Length);
        fs.Flush();
        fs.Close();

posted on 2009-09-15 12:58  画一个圆圈  阅读(198)  评论(0编辑  收藏  举报

导航