mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT AssetAdmin now uses Upload_Validator instead of setting the rules directly on Upload (from r100058)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111618 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
65aa49d564
commit
70105f066e
@ -199,9 +199,15 @@ JS
|
||||
if(!File::$apply_restrictions_to_admin && Permission::check('ADMIN')) {
|
||||
$valid = true;
|
||||
} else {
|
||||
|
||||
// Set up the validator instance with rules
|
||||
$validator = new Upload_Validator();
|
||||
$validator->setAllowedExtensions(File::$allowed_extensions);
|
||||
$validator->setAllowedMaxFileSize(self::$allowed_max_file_size);
|
||||
|
||||
// Do the upload validation with the rules
|
||||
$upload = new Upload();
|
||||
$upload->setAllowedExtensions(File::$allowed_extensions);
|
||||
$upload->setAllowedMaxFileSize(self::$allowed_max_file_size);
|
||||
$upload->setValidator($validator);
|
||||
$valid = $upload->validate($tmpFile);
|
||||
if(!$valid) {
|
||||
$errorsArr = $upload->getErrors();
|
||||
|
Loading…
Reference in New Issue
Block a user