Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

[solved] Allowed File Extensions


Reply


5 Posts   985 Views

Avatar
patattrash

Community Member, 14 Posts

24 June 2014 at 3:02am

Just wondering if there is a better way to add to the $allowed_extension list in File.php. It seems you used to be able to add this to your _config file, but because it's been switched to private I'm not able to do that anymore. Wondering if there is a way to add file types without editing the framework's core.

Avatar
simon_w

Forum Moderator, 474 Posts

24 June 2014 at 9:52am

You now use the Config API or a YAML file to do this.

The YAML syntax is:

File:
allowed_extensions:
- new_ext
- other_ext

That would go in mysite/_config/config.yml.

Avatar
camfindlay

Forum Moderator, 188 Posts

24 June 2014 at 10:28am

Thanks for that simon_w, perhaps we should add this example to the docs? Best place would probably be http://doc.silverstripe.org/framework/en/reference/uploadfield

patattrash, if this solves your problem please edit your original thread title to include [solved] prefix :)

Avatar
patattrash

Community Member, 14 Posts

25 June 2014 at 8:55am

simon_w, thanks for the quick reply and sorry I didn't notice the update earlier. That took care of it for me.

Avatar
camfindlay

Forum Moderator, 188 Posts

25 June 2014 at 2:56pm

I have actually created a pull request to add this to the documentation https://github.com/silverstripe/silverstripe-framework/pull/3233