FIX: File extensions are case sensitive
-
I was adding some new filetypes to Memphis, and I added “adf” with a mimetype of “application/octet-stream”. Then I tried to upload a file and it failed, with “Memphis Error: Sorry, this file type is not permitted for security reasons.”
The problem, it seems, is that the extension of the actual file was ADF instead of adf.
This is a bug in my opinion (Otherwise, I’d have to add mimetypes for all of the upper- and lowercase variations of each new mimetype I wanted to add).The fix is to change line 44 in mdocs-upload.php
from:
$found_ext = strpos($type,$file_type['ext']);
to:
$found_ext = stripos($type,$file_type['ext']);
strpos is case sensitive, stripos is not.
- The topic ‘FIX: File extensions are case sensitive’ is closed to new replies.