17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1178 Views |
-
Uploading a PDF file in the CMS Popup for a DataObject

5 December 2008 at 4:51am
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!
-
Re: Uploading a PDF file in the CMS Popup for a DataObject

5 December 2008 at 4:55am
Hi Andrew
I always use a FileIFrameField for that sort of thing, seems to work fine. Haven't tried using the FileField so cant comment on that.
-
Re: Uploading a PDF file in the CMS Popup for a DataObject

5 December 2008 at 5:07am
That works perfect! Thanks so much!
-
Re: Uploading a PDF file in the CMS Popup for a DataObject

5 December 2008 at 5:08am
no probs, glad I could help!
| 1178 Views | ||
|
Page:
1
|
Go to Top |


