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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Define upload directory for FileFields

Go to End

2 Posts   1669 Views


Community Member, 46 Posts

6 April 2008 at 6:01am

Edited: 06/04/2008 6:05am

Hi there,

I want to define the upload directory for different fields that i am using in the cms to keep them organised. For example...

$fields->addFieldToTab("Root.Content.Files", new FileIFrameField('SermonMP3', 'MP3 Audio'));
$fields->addFieldToTab("Root.Content.Files", new FileIFrameField('SermonPDF', 'PDF Download'));

I want the MP3 to save into "/assets/MP3" and PDF to save into ".assets/PDF".

Is there anyway to do this?


Forum Moderator, 801 Posts

6 April 2008 at 6:52pm

currently you can't switch uploads based on their mimetype out of the box - please subclass FileIframeField and overwrite its saveInto() method. would be great if you can provide your customization in the forum, perhaps we can find a way to integrate this into the core.