We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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?