string image = this.Image1.ImageUrl;
有个一个图片asp:image控制保存着
想把转化成System.IO.Stream
请问该怎么写?
System.IO.Stream oStream=?????

解决方案 »

  1.   

    lz是想把image的imageurl保存到文本中吗?
    StreamWriter SWReport = new StreamWriter(路径);
     SWReport.Write(内容);
      

  2.   

     if (File.Exists(LocalFullPath))
                    {
                        FileStream Stream = new FileStream(LocalFullPath, FileMode.Open, FileAccess.Read);
                        byte[] bt = new byte[Stream.Length];
                        Stream.Read(bt, 0, (Int32)Stream.Length);                       Stream.Close();
                     
                    }拿到路径。然后转换成byte
      

  3.   

    System.IO.Stream oStream = System.IO.File.OpenRead(image);
      

  4.   

    你这个换成byte后,怎么形成System.IO.Stream oStream呢?
      

  5.   


    我以为你要2进制字节保存数据库的
    System.IO.Stream oStream = System.IO.File.OpenRead(image);直接这样拿就可以了。
      

  6.   

    <asp:Image ID="Image1" runat="server" ImageUrl="~/a.jpg" />
    String path = Server.MapPath(Image1.ImageUrl);
    System.IO.Stream stream = System.IO.File.Open(path, System.IO.FileMode.Open);