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

Image upload from cms popup


Reply


8 Posts   5458 Views

Avatar
leocelis

Community Member, 5 Posts

30 January 2008 at 5:36pm

Edited: 30/01/2008 5:38pm

Has anyone created a image field in the CMS form popup?

I'm getting this error.

Avatar
leocelis

Community Member, 5 Posts

30 January 2008 at 5:39pm

I post the image

Avatar
leocelis

Community Member, 5 Posts

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 right

enctype

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;
   }

Avatar
Ingo

Forum Moderator, 801 Posts

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

Avatar
leocelis

Community Member, 5 Posts

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

user_error(Bad class to singleton() - WhatsHotWhatsNOTDataObject,256)
line 78 of Core.php

singleton(WhatsHotWhatsNOTDataObject)
line 1504 of DataObject.php

DataObject::get_one(WhatsHotWhatsNOTDataObject,`WhatsHotWhatsNOTDataObject`.`ID` = 1)
line 1594 of DataObject.php

DataObject::get_by_id(WhatsHotWhatsNOTDataObject,1)
line 445 of Image.php

Image_Uploader->linkedObj()
line 460 of Image.php

Image_Uploader->Image()

call_user_func_array(Array,Array)
line 294 of ViewableData.php

ViewableData->obj(Image,,1)
line 948 of ViewableData.php

ViewableData_Customised->obj(Image,,1)
line 20 of .cacheC..xampp.htdocs.vancouverlivingdev.sapphire.templates.Image_iframe.ss

include(C:\Users\rochita\AppData\Local\Temp\silverstripe-cacheC--xampp-htdocs-vancouverlivingdev\.cacheC..xampp.htdocs.vancouverlivingdev.sapphire.templates.Image_iframe.ss)
line 190 of SSViewer.php

SSViewer->process(ViewableData_Customised)
line 228 of Controller.php

Controller->run(Array)
line 76 of Director.php

Director::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

Avatar
Fuzz10

Community Member, 787 Posts

5 February 2008 at 8:40am

thread subscribe

Avatar
quicked

Community Member, 32 Posts

5 February 2008 at 1:25pm

subscribe

Avatar
Double-A-Ron

Community Member, 604 Posts

15 June 2008 at 5:05pm

subscribe