2010-01-28 08:26:00 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class TestFileUploadPage extends TestPage{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class TestFileUploadPage_Controller extends TestPage_Controller{
|
|
|
|
|
|
|
|
function Form(){
|
2012-06-29 14:27:32 +02:00
|
|
|
$fields = new FieldList(
|
2010-01-28 08:26:00 +01:00
|
|
|
new EmailField('Email', 'EmailField'),
|
|
|
|
new FileField('AFile','FileField'),
|
2012-06-29 14:47:50 +02:00
|
|
|
$aImage = new UploadField('AImage','SimpleImageField')
|
2010-01-28 08:26:00 +01:00
|
|
|
);
|
|
|
|
|
2012-06-29 14:47:50 +02:00
|
|
|
$aImage->allowedExtensions = array('jpg', 'gif', 'png');
|
|
|
|
|
2012-06-29 14:27:32 +02:00
|
|
|
$actions = new FieldList(
|
2010-01-28 08:26:00 +01:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|