Can $_FILES[…]['size'] be forged?

后端 未结 2 1842
深忆病人
深忆病人 2021-01-06 12:37

There\'s a well-known caveat about not trusting the MIME type sent via file upload in PHP ($_FILES[...][\'type\']) as this is sent by the HTTP client and could

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 12:47

    Nope. I don't believe the $_FILES[]['size'] array can display false information. Maybe those who are concerned by it, may be referring to compression-related scenarios. Wherein the actual file may be compressed, to the point it does not reflect the file's real value.

    As far as the size is concerned, the only part not to be trusted is the MAX_FILE_SIZE attribute

提交回复
热议问题