File upload failure: file extension not permitted even it's allowed in the field setting

Hi, I found my multifile upload doesn’t support the “allowed extension”,when I try to upload a .DWG file which is set to permitted in the upload field setting:

the frontend still shows this warning: Sorry, this file extension is not permitted for security reasons. See snapshot.

I reckon this has something to do with the MIME check, is there a filter in Gravity Forms to fix this or is it just me having this issue?

WordPress will also prevent uploading certain file types. As well as including the extension in the Gravity Forms upload field allowed list on the field you would need to use the WordPress upload_mimes filter to add support for additional mime types. Example of how to use that: https://paulund.co.uk/change-wordpress-upload-mime-types

Hi Samuel,
Thanks for the tips! It verifies my guess, however many file extensions are not listed in MIME type, so what should I do under this circumstance?

I found a solution here: https://tribulant.com/blog/wordpress/how-to-fix-sorry-this-file-type-is-not-permitted-for-security-reasons/

And it has a config setting to disable the MIME check, guess it’s the best way, but also the most dangerous way…

I don’t recommend you to turn off default checkings for the file types, that’s there for reason: protect your site.

Most used file types are already covered by WP defaults, if you need to add a few ones that’s something you will need to do only once, so it’s not a big deal IMHO.

1 Like