mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
commit
f0ca37fdea
@ -534,10 +534,8 @@ own validation.
|
|||||||
// Limit extensions on upload (in PHP)
|
// Limit extensions on upload (in PHP)
|
||||||
// Markup contains <input type="file" data-allowed-extensions="jpg,jpeg,gif" />
|
// Markup contains <input type="file" data-allowed-extensions="jpg,jpeg,gif" />
|
||||||
$exts = array('jpg', 'jpeg', 'gif');
|
$exts = array('jpg', 'jpeg', 'gif');
|
||||||
$validator = new Upload_Validator();
|
$fileField = FileField::create('MyFile');
|
||||||
$validator->setAllowedExtensions($exts);
|
$fileField->getValidator()->setAllowedExtensions($exts);
|
||||||
$upload = Upload::create()->setValidator($validator);
|
|
||||||
$fileField = FileField::create('MyFile')->setUpload(new);
|
|
||||||
$fileField->setAttribute('data-allowed-extensions', implode(',', $exts));
|
$fileField->setAttribute('data-allowed-extensions', implode(',', $exts));
|
||||||
|
|
||||||
Note that these examples don't have any effect on the client as such, but are
|
Note that these examples don't have any effect on the client as such, but are
|
||||||
|
Loading…
Reference in New Issue
Block a user