SHARE
TWEET

Untitled

a guest Oct 12th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static byte[] Bytes(HttpPostedFileBase result)
  2. {
  3.     byte[] data;
  4.     using (Stream inputStream = result.InputStream)
  5.     {
  6.         MemoryStream memoryStream = inputStream as MemoryStream;
  7.         if (memoryStream == null)
  8.         {
  9.             memoryStream = new MemoryStream();
  10.             inputStream.CopyTo(memoryStream);
  11.         }
  12.         data = memoryStream.ToArray();
  13.     }
  14.  
  15.     return data;
  16. }
RAW Paste Data
Top