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.

Archive /

Our old forums are still available as a read-only archive.

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

Adding image upload to cms


Reply


3 Posts   1057 Views

Avatar
StuM

Community Member, 56 Posts

8 September 2008 at 9:30am

Edited: 08/09/2008 9:36am

Hi All,

I tried the following tutorial:

http://doc.silverstripe.com/doku.php?id=imageupload

but it doesn't seem to work, no images are uploaded.

The indexes are created and present in the table for the page type, and images can be uploaded via Files/Uploads, so that works as well.

my code:

...
static $has_one = array(
      'LeftAd' => 'Image',
      'LeftBottomAd' => 'Image'
   );

...

public function getCMSFields() {
      $fields = parent::getCMSFields();
      $fields->addFieldToTab('Root.Content.LeftAdvertisement', new SimpleImageField('LeftAd', 'Left Top Ad'));
      ...
      $fields->addFieldToTab('Root.Content.LeftAdvertisement', new SimpleImageField('LeftBottomAd', 'Left Bottom Ad'));
      ...
      return $fields;
   }

any clues???

I'm using daily build version from Monday 1st September

Avatar
StuM

Community Member, 56 Posts

8 September 2008 at 9:55am

OK, just changed the SimpleImageField to an ImageField and it works, so all good now

Avatar
Willr

Forum Moderator, 5513 Posts

8 September 2008 at 12:12pm

Ive updated the doc. Should use an ImageField anyway. SimpleImage fields are normally for front end eg sign up forms.