We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

getExtension() not displaying file extension

getExtension() not displaying file extension(its showing in array only) but getName() displaying file name and size .

here is the code and its out

 $request = new \Phalcon\Http\Request();

                  if ($request->hasFiles() == true) {

                    foreach ($request->getUploadedFiles() as $file){

                         print_r($file);

                        echo $file->getName();

                        echo $file->getExtension();  

                        die;

Output :

Phalcon\Http\Request\File Object
(
    [_name:protected] => 39889408img0004a.jpg
    [_tmp:protected] => /tmp/phpLwezQb
    [_size:protected] => 3308
    [_type:protected] => image/jpeg
    [_real_type:protected] => 
    [_error:protected] => 0
    [_key:protected] => fileUpload
    [_extension:protected] => jpg
    [pathName:SplFileInfo:private] => /tmp/phpLwezQb
    [fileName:SplFileInfo:private] => phpLwezQb
)

39889408img0004a.jpg

cant output echo $file->getExtension();



98.9k

This is fixed in 1.3.4 are you using that version?