Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Define upload directory for FileFields

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

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

Page: 1
Go to End
Author Topic: 1478 Views
  • fordy
    Community Member
    46 Posts

    Define upload directory for FileFields Link to this post

    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?

  • Ingo
    Forum Moderator
    801 Posts

    Re: Define upload directory for FileFields Link to this post

    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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.