How can I determine a file's true extension/type programmatically?

前端 未结 11 1319
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 17:06

I am working on a script that will process user uploads to the server, and as an added layer of security I\'d like to know:

Is there a way to detect a file\'s true e

11条回答
  •  春和景丽
    2020-12-01 17:41

    Executables in general have a "signature" on the first bytes; I find it hard though to really ascertain what the file type really is.

提交回复
热议问题