mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT AssetAdmin now uses Upload_Validator instead of setting the rules directly on Upload
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@100058 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
55520f1523
commit
4dd3740682
@ -218,9 +218,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) {
|
||||
$errors = $upload->getErrors();
|
||||
|
Loading…
Reference in New Issue
Block a user