Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » setField('Filename... ignored in Upload.php

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: 1322 Views
  • Wilson
    Avatar
    Community Member
    63 Posts

    setField('Filename... ignored in Upload.php Link to this post

    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:

    /assets/7/Photo-Gallery/myFile.jpg

    It's written to the database as:

    /assets/myFile.jpg

    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!

    Wilson

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: setField('Filename... ignored in Upload.php Link to this post

    <withdrawn rant as previous comment deleted>

  • stefant42
    Avatar
    Community Member
    14 Posts

    Re: setField('Filename... ignored in Upload.php Link to this post

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

    1322 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.