silverstripe-frameworktest/code/TestFileUploadPage.php
Sean Harvey 884b5305ed Merge pull request #9 from mandrew/frameworktest-fixes
BUG: fixes for 3.1 version
2014-02-18 10:14:03 +13:00

35 lines
733 B
PHP

<?php
class TestFileUploadPage extends TestPage{
}
class TestFileUploadPage_Controller extends TestPage_Controller{
private static $allowed_actions = array(
'Form'
);
function Form(){
$fields = new FieldList(
new EmailField('Email', 'EmailField'),
new FileField('AFile','FileField'),
$aImage = new UploadField('AImage','SimpleImageField')
);
$aImage->allowedExtensions = array('jpg', 'gif', 'png');
$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();
$this->redirectBack();
}
}