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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

[Notice] Undefined offset: 0


Reply


2 Posts   719 Views

Avatar
otherjohn

Community Member, 125 Posts

15 July 2011 at 1:16am

Edited: 15/07/2011 1:48am

Ok, using the newest version of uploadify AND DataObjectManager.

I am uploading MP3s using S3Upload which it seems to upload just fine but when I hit continue to enter in the data on the file I just uploaded I get:

[Notice] Undefined offset: 0
POST /admin/EditForm/field/Sermons/UploadifyForm?SecurityID=02336c564f122add303e0731cc4d3a55244d788d&ctf[Sermons][start]=0&ctf[Sermons][per_page]=10&ctf[Sermons][showall]=0&ctf[Sermons][sort]=&ctf[Sermons][sort_dir]=&ctf[Sermons][search]=&ctf[Sermons][filter]=&ctf[Sermons][view]=

Line 530 in /home/..blah../public_html/dataobject_manager/code/FileDataObjectManager.php

Source

521       $fields->removeByName($this->fileFieldName);
522       $total = isset($_POST['totalsize']) ? $_POST['totalsize'] : sizeof($_POST['uploaded_files']);
523       $index = isset($_POST['index']) ? $_POST['index'] + 1 : 1;
524       $fields->push(new HiddenField('totalsize','',$total));
525       $fields->push(new HiddenField('index','',$index));
526       if(isset($_POST['uploaded_files']) && is_array($_POST['uploaded_files'])) {
527          $remaining_files = $_POST['uploaded_files'];
528          var_dump($_POST['uploaded_files']);
529          //die;
530          $current = $remaining_files[0];
531          $dataObject = DataObject::get_by_id($this->sourceClass(), $current);
532          $fileObject = $dataObject->obj($this->fileFieldName);
533          $fields->push(new HiddenField('current','',$current));
534          unset($remaining_files[0]);
535          if(!$fields->loaded) {
536             foreach($remaining_files as $id)
Trace

FileDataObjectManager->EditUploadedForm()
Line 462 of FileDataObjectManager.php
FileDataObjectManager->saveUploadifyForm(Array,FileDataObjectManager_Popup,SS_HTTPRequest)
Line 329 of Form.php
Form->httpSubmission(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 161 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 161 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 161 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 125 of Director.php
Director::direct(/admin/EditForm/field/Sermons/UploadifyForm)
Line 127 of main.php

public function getCMSFields()
   {
      $f = parent::getCMSFields();
      
      $manager = new FileDataObjectManager(
         $this, // Controller
         'Sermons',
         'SermonCastSermon', // Source class
         'Attachment', // File name on DataObject
         array(
             'SermonDate'=>'Date',
             'Title' => 'Title',
             'Speaker' => 'Speaker'
         ), // Headings
         'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
         // Filter clause
         // Sort clause
         // Join clause
      );
      $manager->setDefaultView("list");
      //$manager->setUploadFolder('/Sermons/');
      $manager->uploadifyField = "S3MultipleUploadField";
      
      $f->fieldByName('Root.Content')->insertBefore(new Tab('Sermons'), 'Main');
      $f->fieldByName('Root.Content')->insertBefore(new Tab('SermonCastDetails'), 'Main');
      
      $f->addFieldToTab("Root.Content.SermonCastDetails", new LiteralField('Explaination','<h2>Podcast Details</h2><p>These details are used in the RSS feed for the podcast - the RSS feed is compatible with iTunes.</p>'));
      $f->addFieldToTab("Root.Content.SermonCastDetails", new TextField('SermonTitle','Sermon Title'));
      $f->addFieldToTab("Root.Content.SermonCastDetails", new TextField('Author','Sermon Author'));
      $f->addFieldToTab("Root.Content.SermonCastDetails", new TextField('OwnerEmail','Sermon Owner Contact Email'));
      $f->addFieldToTab("Root.Content.SermonCastDetails", new TextAreaField('Summary','Sermon Summary'));
      $f->addFieldToTab("Root.Content.SermonCastDetails", new S3UploadField('Image', 'Sermon Image'));
      
      $f->addFieldToTab("Root.Content.Sermons", $manager);
//      if(!Permission::check('ADMIN')) $f->removeFieldFromTab("Root.Content", "Main");

      
      return $f;
         
   }

This started happening right when we were going to launch the site!
Please help!

Avatar
otherjohn

Community Member, 125 Posts

15 July 2011 at 1:34am

Edited: 15/07/2011 2:35am

ignore
528 var_dump($_POST['uploaded_files']);

I was trying to debug.

I don't know if this is relevent, but Uploadify returns an input field called "UploadedFiles[]" with a number value attached to it. I wonder if that field is the same as "uploaded_files"?