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:

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

setField('Filename... ignored in Upload.php

Go to End

3 Posts   1728 Views


Community Member, 63 Posts

3 April 2010 at 6:27am

Hi all,

I'm doing something hacky (I know... ) but planning to fix it later. First I just need it working.

In Upload.php, I'm trying to set the Filename of my upload before it's written to the database. It's currently being written incorrectly. For example, if I upload the file to:


It's written to the database as:


I'm attempting to add this line:

$this->file->setField('Filename', CORRECT VALUE AS A STRING);

... then write()

But it seems to be ignored or overwritten by an ancestor, perhaps DataObject??

In the API docs, it says the 2nd param can be mixed. Does this indicate that it should be an object or array instead of string?

I'm running beta1, but I've looked through trunk and it doesn't look like any of this has a bug in it.

Thanks for your advice!



Forum Moderator, 1899 Posts

1 April 2011 at 10:41am

Edited: 03/04/2011 12:28am

<withdrawn rant as previous comment deleted>


Community Member, 14 Posts

2 April 2011 at 2:39am

I'm sorry but yesterday i was sitting the hole day on the same problems. Sorry for my comment