I would like to have an upload file field in my CMS Popup for my Programs DataObject. So that the user can add a single PDF file for each program. I am able to get the field to show and browse my computer, but when I click save the loader just spins. I can't find much of any documentation on this sort of thing, but I think it's fairly easy to accomplish and I'm just missing a step. Here is my code:
<?php
class Programs extends DataObject {
static $db = array(
'Program' => 'Text',
'Link' => 'Varchar',
'MyCollegesID' => 'Decimal',
);
static $has_one = array(
'CurriculumCard' => 'File',
'Department' => 'Departments',
'Colleges' => 'MyColleges'
);
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push( new TextField( 'Program' ) );
$fields->push( new TextField( 'Link' ) );
$fields->push( new FileField( 'CurriculumCard' ) );
$ctype = DataObject::get("Colleges");
$map = $ctype->toDropDownMap('ID', 'College');
$fields->push( new DropdownField('CollegesID','College',$map));
return $fields;
}
}
?>
Thanks in advance for your help!