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.

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

images don't attached from the frontend

Go to End

3 Posts   1982 Views


Community Member, 32 Posts

8 April 2010 at 6:05pm

It always says "You can add images once you have saved for the first time." but from backed it is ok. all other fields works properly. Please help!
this is for frontend:

function addHotelForm(){                               
    return new Form($this, "addHotelForm",
        new FieldSet(
			new TextField('Title', 'Название'),
            new TextareaField('Description', 'Описание'),
            new TextField('Location', 'Местоположение'),  
			new TextField('Adress', 'Адрес'),
			new TextField('Telefone', 'Телефон'),
			new NumericField('Price', 'Цены'),
			new ImageField('HotelImage', 'Фото Гостиннцы', null, null, null, "assets/Uploads/")
        new FieldSet(
            new FormAction("doSubmitHotel", "добавить новую гостинницу")
		new RequiredFields(

function doSubmitHotel($data, $form){
		$hotel = new Hotel();
		$hotel->HotelHolderID = $this->dataRecord->ID;
			'Гостинница успешно добавлена!',

and for CMS:
function getCMSFields() {
	$fields = parent::getCMSFields();
	$HotelTable = new ComplexTableField($this, 'Hotels', 'Hotel');
	$fields->addFieldToTab('Root.Content.Hotels', $HotelTable);
	return $fields;

the "assets/Uploads/" don't work too, images saved to Uploads folder


Forum Moderator, 5523 Posts

8 April 2010 at 6:59pm

You should use SimpleImageField for the front end form. The incorrect folder location I think was a bug in 2.3 which should be fixed in 2.4.


Community Member, 32 Posts

9 April 2010 at 3:29pm

Thanks Willr