I'm getting several problems with the Uploadify-Module on the same page with the same code.
I wrote two new Resources:
mysite/code/BrochureResource.php
<?php
class BrochureResource extends DataObject
{
static $db = array (
'Title' => 'Text'
);
static $has_one = array (
'Page' => 'Page',
'Attachment' => 'File'
);
}
and mysite/code/SimulationResource.php
<?php
class SimulationResource extends DataObject
{
static $db = array (
'Title' => 'Text'
);
static $has_one = array (
'Page' => 'Page',
'Attachment' => 'File'
);
}
In my ReferencePage.php I have the following code:
class ReferencePage extends Page {
static $db = array(
...
);
static $has_one = array(
...
'Simulation' => 'SimulationResource',
'Brochure' => 'BrochureResource',
'LayoutPhoto' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
// Adding a Brochure
$brochure = new FileUploadField(_t('VEHICLEPAGE.BROCHURE','Brochure.Attachment'));
$brochure->removeFolderSelection();
$brochure->uploadFolder = 'brochure/'.$this->URLSegment;
$brochure->setFileTypes(array('pdf'),_t('VEHICLEPAGE.PDFS','PDFs'));
$fields->addFieldToTab("Root.Content.Main", $brochure, 'Content');
// Adding a Simulation
$simulation = new FileUploadField(_t('VEHICLEPAGE.SIMULATION','Simulation.Attachment'));
$simulation->removeFolderSelection();
$simulation->uploadFolder = 'simulations/'.$this->URLSegment;
$simulation->setFileTypes(array('exe'),_t('VEHICLEPAGE.EXES','EXEs'));
$fields->addFieldToTab("Root.Content.Main", $simulation, 'Content');
// Adding a Layout-Image
$layoutphoto = new ImageUploadField(_t('VEHICLEPAGE.LAYOUTPHOTO','LayoutPhoto'));
$layoutphoto->removeFolderSelection();
$layoutphoto->uploadFolder = 'layout_images/'.$this->URLSegment;
$fields->addFieldToTab("Root.Content.Main", $layoutphoto, $techspecs);
....
....
// Return fields to CMS_Main
return $fields;
}
}
But when I try to upload files with the fields, I get on the first (Brochure) an IO-Error, the second one (Simulation) uploads the file and shows an HTTP-Error when using EXE-Files (if I allow different ones, this field works) and the third (Layout-Image) lets me pick a file but doesn't upload it without showing any errors.
Does somebody (Uncle Cheese) have an idea? (I'm using the trunk builds from today)