Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

FIX: File extensions are case sensitive

$
0
0

Replies: 0

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.


Viewing all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>