Jump to:

23355 Posts in 17838 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Upload to Specific Directory?

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

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

Page: 1
Go to End
Author Topic: 982 Views
  • ttyl
    Avatar
    Community Member
    114 Posts

    Upload to Specific Directory? Link to this post

    I have a page type with a $has_one File and a place to upload the file on the CMS. Is there a way that files uploaded for those types of pages can go to a specified directory? for example, I have a 'employee' page and want to upload the resume - when I upload that resume I want it to go to 'assets/resumes' not 'assets'.

    so it would be

       static $has_one = array(
          'Resume' => 'File'
       );

    and

          $fields->addFieldToTab('Root.Content.Main', new FileIFrameField('Resume', 'Resume'), 'Content');

    in the EmployeePage.php file.

    thanks.

  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: Upload to Specific Directory? Link to this post

    nothing?

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Upload to Specific Directory? Link to this post

    Check this thread - http://www.silverstripe.org/customising-the-cms/show/276189#post276189

    Not sure if it actually got fixed in 2.4 as I haven't touched that in a while. At least in terms of talking about images. Might be different for files.

  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: Upload to Specific Directory? Link to this post

    great this worked!

    new ImageField($name, $title, '', '', '', $folderName = null);

    and also works with FileIFrameField

    982 Views
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.