Jump to:

23550 Posts in 19336 Topics by 2890 members

General Questions

SilverStripe Forums » General Questions » Can't view uploaded Image

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: 1156 Views
  • Todd
    31 Posts

    Can't view uploaded Image Link to this post

    Hi All.

    I'm having a problem with my images, hopefully someone can help.

    I added the following in my page.php file under the "class Page extends SiteTree":

    public static $has_one = array( 'Banner' => 'Image' );

    function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->addFieldToTab("Root.Content.Banner", new ImageField('Banner'));
    return $fields;

    The banner image uploads, but no picture. When I look at the source html it shows: <img src="/assets/" alt="assets/" />

    What am I doing wrong?

  • Willr
    Forum Moderator
    5511 Posts

    Re: Can't view uploaded Image Link to this post

    Have you rebuilt your database (www.yoursite.com/dev/build) to add the new fields for the image?. Next thing you can check is if you go into your database (with phpmyadmin or similar) and you select the 'Page' table you should see a BannerID column. Check this value - if your upload worked then this should not be 0.

  • Todd
    31 Posts

    Re: Can't view uploaded Image Link to this post

    Hi Willr,

    I figured it out. I has a .ss file from a previous project that was interfering with the link. Sorry for wasting your time and many thanks for the quick response and help.


  • Mr V Dot
    Community Member
    8 Posts

    Re: Can't view uploaded Image Link to this post

    Todd, what exactly was in the template file that was messing up your link? I'm having the same problem, but only have one main template (Page.ss) and as far as I can tell not even removing my includes fixes the issue. Thanks

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.