Kernel::System::DataValidation::Validator::FileUploadType

NAME

Kernel::System::DataValidation::Validator::FileUploadType – Validator that verifies that an uploaded file has the correct file type.

PUBLIC INTERFACE

Provides a Check method, that will be called by the Kernel::System::DataValidation backend.

Check()

Checks if the given files have the correct file types. The allowed file types needs to be passed as the Arguments parameter, even wildcards are supported.

    my $True = $Validator->Check(
        Arguments => [
            'image/png',
            'image/jpeg',
            'image/*',
        ],
        Value => [
            {
                Content     => $Content,
                ContentType => $ContentType,
                Filename    => 'lala.txt',
            },
        ],
    );
Scroll to Top