Validate field type file so that it only accepts certificates open ssl in Cakephp 3

0

I have a field type file is the following:

 <?= $this->Form->file('key', [
       'id' => 'form__key',
       'class' => '_oculto js--file__upload',
       'name' => 'key',
       'data-file' => 'application',
       'accept'=> "application/x-x509-ca-cert"
 ]) ?>

That field must upload .cer files in the validation on the model side is as follows:

$validator->allowEmpty('key')
            ->add('key', [ 'mimeType' => [
              'rule' => ['mimeType', ['application/x-x509-ca-cert']] ,
                       'message' => 'Solo se admiten imágenes con extensión.cer' 
                  ],
            ]);

but when uploading the file it sends me the error message and if it is the type of file that I request, I do not know what I am missing or I am doing wrong, I would appreciate your help thanks.

    
asked by Jasi Enriquez 08.11.2018 в 22:50
source

0 answers