/// <summary>
        /// 判断指定文件是否为图片
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public static bool IsImage(Stream stream)
        {
            try
            {
                System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
            finally
            {
                stream.Seek(0, SeekOrigin.Begin);  
            }
        }

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
猜你喜欢
  • 2021-10-19
  • 2022-01-01
  • 2021-07-14
  • 2021-12-29
  • 2021-09-15
相关资源
相似解决方案