How to allow file extensions in Craft CMS

Oscar de la Hera Gomez
A flower that represents Craft CMS with the text 'Allow File Extensions' beneath it.

In order to allow file extensions, such as .ai, .indd, .psd, .glb or .usdz, you must add them to extraAllowedFileExtensions in the general.php file.

Craft CMS comes with a lot of out of the box file extensions (listed below) but does not allow ALL file extensions to be uploaded to a backend (i.e. S3).

When you try to attempt a file that is not allowed you will get a message like 'filetype' is not an allowed file extension.

In order to allow extra file extensions that are not allowed by default we must be configure the general.php file to allow for them.

What file extensions are allowed out of the box ?

A screenshot of the Craft CMS file extensions that are allowed by default.

.7z, .aiff, .asc, .asf, .avi, .avif, .bmp, .cap, .cin, .csv, .dfxp, .doc, .docx, .dotm, .dotx, .fla, .flv, .gif, .gz, .gzip, .itt, .jp2, .jpeg, .jpg, .jpx, .js, .json, .lrc, .m2t, .m4a, .m4v, .mcc, .mid, .mov, .mp3, .mp4, .mpc, .mpeg, .mpg, .mpsub, .ods, .odt, .ogg, .ogv, .pdf, .png, .potx, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .ppz, .pxd, .qt, .ram, .rar, .rm, .rmi, .rmvb, .rt, .rtf, .sami, .sbv, .scc, .sdc, .sitd, .smi, .srt, .stl, .sub, .svg, .swf, .sxc, .sxw, .tar, .tds, .tgz, .tif, .tiff, .ttml, .txt, .vob, .vsd, .vtt, .wav, .webm, .webp, .wma, .wmv, .xls, .xlsx, .zip.

How to allow new file extensions

A screenshot of VSCode with the general.php file open, its location highlighted and the suggested line below highlighted as well.

Update the general.php to include extraAllowedFileExtensions along with the file extensions you wish to allow for these to be accepted by the Craft CMS. A sample line that can be added to the config to allow .glb and .usdz is found below.

'extraAllowedFileExtensions' => 'usdz, glb'

In Craft4+ its the following:

->extraAllowedFileExtensions(['usdz', 'glb'])

Once you've added the line, restart your local environment or push changes to be able to upload the file types that you added to your general.php.

Any Questions ?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.

delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details