0
I need to upload a file with the extension .pfx
(digital certificate).
I’m using the library
Upload
of CodeIgniter
as follows:
I’m putting the extension allowed_types but does not send. Returns: The file type you are trying to upload is not allowed.
$config['upload_path'] = $pasta;
$config['allowed_types'] = 'pfx';
$config['max_size'] = 100000;
$config['encrypt_name'] = TRUE;
$this - > load - > library('upload');
$this - > upload - > initialize($config);
if ($this - > upload - > do_upload('userfile')) {
echo json_encode(array('image1' = > $this - > upload - > data('file_name'), 'file_ext' = > str_replace(".", "", $this - > upload - > data('file_ext')), 'error' = > 0, 'mensage' = > 'Arquivo enviado com sucesso.'));
} else {
echo json_encode(array('mensage' = > $this - > upload - > display_errors(), 'error' = > 1));
}
make a
var_dump
in the$config
and in the$_FILES
please.– RFL
C: wamp64 www application controllers Upload.php:127: array (size=4) 'upload_path' => string 'C:/wamp64 /www/public/clients/lumer/certificate/' (length=48) 'allowed_types' => string 'pfx' (length=3) 'max_size' => int 100000 encrypt_name=> Boolean true
– Clayton Eduardo Mergulhão
C: wamp64 www application controllers Upload.php:127: array (size=1) 'userfile' => array (size=5) 'name' => string 'LUMER_INFORMATICA_LTDA_ME10422724000187 . pfx' (length=43) 'type' => string 'application /octet-stream' (length=24) 'tmp_name' => string 'C: wamp64 tmp php6D29.tmp' (length=25) 'error' => int 0 'size' => int 9527
– Clayton Eduardo Mergulhão
you initialized the settings?
$this->upload->initialize($config);
– RFL
yes I initialized that way
– Clayton Eduardo Mergulhão
Make the change in the post please! :)
– RFL