Skip to main content
deleted 132 characters in body
Source Link
Graham
  • 7.9k
  • 20
  • 67
  • 92

I think the best option for you, please Try BinaryReader Try BinaryReader:

 /// <summary>  /// Convert the Binary AnyFile to Byte[] format  /// </summary>  /// <param name="image"></param>  /// <returns></returns>  public static byte[] ConvertANYFileToBytes(HttpPostedFileBase image)  {   byte[] imageBytes = null;   BinaryReader reader = new BinaryReader(image.InputStream);   imageBytes = reader.ReadBytes((int)image.ContentLength);   return imageBytes;  } 

I think the best option for you, please Try BinaryReader

 /// <summary>  /// Convert the Binary AnyFile to Byte[] format  /// </summary>  /// <param name="image"></param>  /// <returns></returns>  public static byte[] ConvertANYFileToBytes(HttpPostedFileBase image)  {   byte[] imageBytes = null;   BinaryReader reader = new BinaryReader(image.InputStream);   imageBytes = reader.ReadBytes((int)image.ContentLength);   return imageBytes;  } 

Try BinaryReader:

/// <summary> /// Convert the Binary AnyFile to Byte[] format /// </summary> /// <param name="image"></param> /// <returns></returns> public static byte[] ConvertANYFileToBytes(HttpPostedFileBase image) { byte[] imageBytes = null; BinaryReader reader = new BinaryReader(image.InputStream); imageBytes = reader.ReadBytes((int)image.ContentLength); return imageBytes; } 
Source Link
PatsonLeaner
  • 1.3k
  • 16
  • 29

I think the best option for you, please Try BinaryReader

 /// <summary> /// Convert the Binary AnyFile to Byte[] format /// </summary> /// <param name="image"></param> /// <returns></returns> public static byte[] ConvertANYFileToBytes(HttpPostedFileBase image) { byte[] imageBytes = null; BinaryReader reader = new BinaryReader(image.InputStream); imageBytes = reader.ReadBytes((int)image.ContentLength); return imageBytes; }