How to create byte array from HttpPostedFile

后端 未结 6 871
广开言路
广开言路 2020-11-29 16:59

I\'m using an image component that has a FromBinary method. Wondering how do I convert my input stream into a byte array

HttpPostedFile file = context.Reques         


        
6条回答
  •  难免孤独
    2020-11-29 17:21

    For images if your using Web Pages v2 use the WebImage Class

    var webImage = new System.Web.Helpers.WebImage(Request.Files[0].InputStream);
    byte[] imgByteArray = webImage.GetBytes();
    

提交回复
热议问题