Пример #1
0
        /// <summary>
        /// Method to check if file is image file
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        private bool CheckIfImageFile(IFormFile file)
        {
            var ms = new MemoryStream();

            file.CopyTo(ms);
            return(WriterHelper.GetImageFormat(ms) != WriterHelper.ImageFormat.unknown);
        }
Пример #2
0
 private bool IsImageValid(IFormFile image)
 {
     byte[] fileBytes;
     using (var ms = new MemoryStream())
     {
         image.CopyTo(ms);
         fileBytes = ms.ToArray();
     }
     return(WriterHelper.GetImageFormat(fileBytes) != WriterHelper.ImageFormat.unknown);
 }
Пример #3
0
 private bool CheckIfImageFile(IFormFile file)
 {
     byte[] fileBytes;
     using (var ms = new MemoryStream())
     {
         file.CopyTo(ms);
         fileBytes = ms.ToArray();
     }
     return(WriterHelper.GetImageFormat(fileBytes) != WriterHelper.ImageFormat.unknown);
 }
Пример #4
0
 /// <summary>
 /// Method to check if file is image file
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 public bool CheckIfImageFile(IFormFile file)
 {
     if (file != null)
     {
         byte[] fileBytes;
         using (MemoryStream ms = new MemoryStream())
         {
             file.CopyTo(ms);
             fileBytes = ms.ToArray();
         }
         return(WriterHelper.GetImageFormat(fileBytes) != WriterHelper.ImageFormat.unknown);
     }
     return(false);
 }