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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Add file upload types


Go to End


4 Posts   3028 Views

Avatar
gman

Community Member, 11 Posts

10 August 2010 at 3:05pm

I noticed that by default .odt is not an allowed file upload. Where do you change the file types allowed for upload?

Avatar
swaiba

Forum Moderator, 1899 Posts

10 August 2010 at 8:11pm

I think something like the following might help... this means you have to intercept the field in getCMSfields and also not that these are case sensitive.... please look at sapphire\forms\FileField.php for more info....

$uploadField->setAllowedExtensions('odt');

Avatar
Invader_Zim

Community Member, 141 Posts

11 August 2010 at 12:19am

An alternative solution would be to add this line

File::$allowed_extensions[] = 'odt';

to your mysite/_config.php.

Cheers,
Christian

Avatar
Brendo

Community Member, 7 Posts

10 December 2013 at 4:53pm

Gman,

did you solve your issue?

do you have any problems linking or accessing the file once uploaded?

regards

Brendon