silverstripe-frameworktest/code/TestFileUploadPage.php
Normann Lou 0a4f22a08f ENHANCEMENT: use FieldList constructor to replace FieldSet constructor for SilverStripe 3
ENHANCEMENT: use FormActioin constructor to replace ImageFormAction constructor for SilverStripe 3
2012-06-30 00:27:32 +12:00

28 lines
612 B
PHP

<?php
class TestFileUploadPage extends TestPage{
}
class TestFileUploadPage_Controller extends TestPage_Controller{
function Form(){
$fields = new FieldList(
new EmailField('Email', 'EmailField'),
new FileField('AFile','FileField'),
new SimpleImageField('AImage','SimpleImageField')
);
$actions = new FieldList(
new FormAction('addMember', "Add a member with two Files uploaded")
);
return new Form($this, "Form", $fields, $actions);
}
function addMember($data, $form){
$member = new Member();
$form->saveInto($member);
$member->write();
Director::redirectBack();
}
}