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

Call to undefined method Phalcon\Http\Request\File::getExtension()

Hi!

First of all, thanks for a brilliant and super fast framework! Great work!

I'd like to ask about Phalcon's File class. In the documentation, there's a method getExtension(), although, when trying to use it, I get a fatal error, that the method is undefined. Methods inherited from SplFileInfo like getRealType() are defined and work correctly. The moveTo() method also works like a charm. Am I doing something wrong or perhaps getExtension() is not yet implemented? Using Phalcon 1.3.1

Here's the PHP code:

if($this->request->hasFiles() == true) {
        foreach($this->request->getUploadedFiles() as $file) {
            die($file->getExtension());
        }
}

Thanks in advance!



98.9k
Accepted
answer

Could you please try again using 1.3.3?

Thank you for your response!

But unfortunately since my project is on a shared hosting, it's not an option at the moment. But I managed to solve this by using pathinfo().

1.3.3 (windows, linux) is already available?