Merge pull request #3480 from halkyon/allowed_exts_doc_change

Fixing broken docs on setting allowed extensions on a FileField
This commit is contained in:
Simon Welsh 2014-09-09 09:43:05 +10:00
commit f0ca37fdea

View File

@ -534,10 +534,8 @@ own validation.
// Limit extensions on upload (in PHP)
// Markup contains <input type="file" data-allowed-extensions="jpg,jpeg,gif" />
$exts = array('jpg', 'jpeg', 'gif');
$validator = new Upload_Validator();
$validator->setAllowedExtensions($exts);
$upload = Upload::create()->setValidator($validator);
$fileField = FileField::create('MyFile')->setUpload(new);
$fileField = FileField::create('MyFile');
$fileField->getValidator()->setAllowedExtensions($exts);
$fileField->setAttribute('data-allowed-extensions', implode(',', $exts));
Note that these examples don't have any effect on the client as such, but are