17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 5164 Views |
-
Image upload from cms popup

30 January 2008 at 5:36pm Last edited: 30 January 2008 5:38pm
Has anyone created a image field in the CMS form popup?
I'm getting this error.
-
Re: Image upload from cms popup

31 January 2008 at 7:45am
Here is the error. It's happens when I tried to upload a image from the form of the CMS popup, I just did the form exactly like the this tutorial: http://doc.silverstripe.com/doku.php?id=tutorial:5-dataobject-relationship-management
Error:
===================================
ERROR:Error 256: File::loadUploaded() Not passed an array. Most likely, the form hasn't got the rightenctype
At l152 in C:\xampp\htdocs\vancouverlivingdev\sapphire\filesystem\File.php
user_error(File::loadUploaded() Not passed an array. Most likely, the form hasn't got the right enctype
,256)
line 152 of File.php
File->loadUploaded()
line 113 of Image.php
Image->loadUploaded()
line 14 of SimpleImageField.php
SimpleImageField->saveInto(WhatsHotWhatsNOTDataObject)
line 543 of Form.php
Form->saveInto(WhatsHotWhatsNOTDataObject)
line 702 of ComplexTableField.php
ComplexTableField_Popup->saveComplexTableField(Array,ComplexTableField_Popup)
line 197 of Controller.php
Controller->run(Array)
line 76 of Director.php
Director::direct(/admin/)
line 104 of main.php
Code:
======================
// lists
function getCMSFields()
{
$fields = parent::getCMSFields();$tablefield = new HasManyComplexTableField(
$this,
'Posts',
'WhatsHotWhatsNOTDataObject',
array(
"Whats" => "Whats HOT Whats NOT",
'Title' => 'Title',
'Description' => 'Description',
'VotesAgree' => 'Votes Agree',
'VotesDisagree' => 'Votes Disagree',
'Datetime' => 'Date and time',
'Active' => 'Active',
'Offensive' => 'Mark as offensive',
'Home' => 'Home'
),
'getCMSFields_forPopup'
);$fields->addFieldToTab( 'Root.Content.Posts', $tablefield );
return $fields;
}// CMS
function getCMSFields_forPopup()
{
$o = new FieldSet();
$o->push(
new SimpleImageField("Picture", "Image:")
);
return $o;
} -
Re: Image upload from cms popup

31 January 2008 at 6:16pm
the popup form is submitted via javascript/ajax, which means you can't use file-uploads in forms. have you tried using ImageField instead of SimpleImageField? this uploads through an iframe instead, which i'm pretty sure works in the popup as well
-
Re: Image upload from cms popup

2 February 2008 at 5:27am
I did, but this error is shown:
FATAL ERROR: Bad class to singleton() - WhatsHotWhatsNOTDataObject
At line 78 in C:\xampp\htdocs\vancouverlivingdev\sapphire\core\Core.phpuser_error(Bad class to singleton() - WhatsHotWhatsNOTDataObject,256)
line 78 of Core.phpsingleton(WhatsHotWhatsNOTDataObject)
line 1504 of DataObject.phpDataObject::get_one(WhatsHotWhatsNOTDataObject,`WhatsHotWhatsNOTDataObject`.`ID` = 1)
line 1594 of DataObject.phpDataObject::get_by_id(WhatsHotWhatsNOTDataObject,1)
line 445 of Image.phpImage_Uploader->linkedObj()
line 460 of Image.phpImage_Uploader->Image()
call_user_func_array(Array,Array)
line 294 of ViewableData.phpViewableData->obj(Image,,1)
line 948 of ViewableData.phpViewableData_Customised->obj(Image,,1)
line 20 of .cacheC..xampp.htdocs.vancouverlivingdev.sapphire.templates.Image_iframe.ssinclude(C:\Users\rochita\AppData\Local\Temp\silverstripe-cacheC--xampp-htdocs-vancouverlivingdev\.cacheC..xampp.htdocs.vancouverlivingdev.sapphire.templates.Image_iframe.ss)
line 190 of SSViewer.phpSSViewer->process(ViewableData_Customised)
line 228 of Controller.phpController->run(Array)
line 76 of Director.phpDirector::direct(/images/iframe/WhatsHotWhatsNOTDataObject/1/Picture)
line 104 of main.php
Context
Debug (Debug::showError() in line 149 of Debug.php)* className =
WhatsHotWhatsNOTDataObject
* _SINGLETONS =
o Member =
Database record: Member
+ ID :0
| 5164 Views | ||
|
Page:
1
|
Go to Top |





