File upload (file.php): Check last .xxx as file ext
-
Servus,
when using file upload, there is a check (inside file.php, lines 1.108 ff) for an allowed file type (= file extension):
– it checks (stripos) for the *first* occurance of any limited file type
That is, by chance, a file containing the file extension in the file name itself, will be rejected.Example:
– let $limit_type be “pdf”
– check of file “dummy.pdfPattern.one.pdf” will be rejected (because stripos finds pos=5 (.pdfPattern…) instead of real extension “.pdf”Solution proposal:
– use strripos instead of stripos, which will find the last position of extension
– or use any a other check, e.g.
– strlen(substr($file[‘name’]) > strlen($limit_type)
– and substr($file[‘name’], -1 * strlen($limit_type))Gru? from Bavaria,
Daniel
- The topic ‘File upload (file.php): Check last .xxx as file ext’ is closed to new replies.