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

Upload to Specific Directory?


Go to End


4 Posts   1446 Views

Avatar
ttyl

Community Member, 114 Posts

5 May 2010 at 9:14am

Edited: 05/05/2010 9:16am

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.

Avatar
ttyl

Community Member, 114 Posts

6 May 2010 at 5:51am

nothing?

Avatar
Liam

Community Member, 470 Posts

6 May 2010 at 1:38pm

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.

Avatar
ttyl

Community Member, 114 Posts

7 May 2010 at 6:52am

great this worked!

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

and also works with FileIFrameField