Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Image upload from cms popup

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

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

Page: 1
Go to End
Author Topic: 5418 Views
  • leocelis
    Avatar
    Community Member
    5 Posts

    Image upload from cms popup Link to this post

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

    I'm getting this error.

  • leocelis
    Avatar
    Community Member
    5 Posts

    Re: Image upload from cms popup Link to this post

    I post the image

  • leocelis
    Avatar
    Community Member
    5 Posts

    Re: Image upload from cms popup Link to this post

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

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Image upload from cms popup Link to this post

    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

  • leocelis
    Avatar
    Community Member
    5 Posts

    Re: Image upload from cms popup Link to this post

    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

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Image upload from cms popup Link to this post

    thread subscribe

  • quicked
    Avatar
    Community Member
    32 Posts

    Re: Image upload from cms popup Link to this post

    subscribe

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Image upload from cms popup Link to this post

    subscribe

    5418 Views
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.