We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 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){


                        echo $file->getName();

                        echo $file->getExtension();  


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


cant output echo $file->getExtension();


This is fixed in 1.3.4 are you using that version?