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.

Archive /

Our old forums are still available as a read-only archive.

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

filefield $allowed_file_types help


Go to End


2498 Views

Avatar
spunktastica

Community Member, 2 Posts

19 June 2008 at 5:30am

So I want to add a file upload to a page. I want the user to only upload pdf's. I've looked through the tutorials and the documentation and I've managed to add a filefield but I don't have a clue how to limit it to PDF. I found the $allowed_file_types property but don't know how to apply it. Can someone help me?

$fields->addFieldToTab("Root.Content.Files", new FileField('Pdf'))

Thanks