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.

Loop over all json files in directory

I'd like to get all .json files in my directory. Then I did that :

foreach (glob("files/my/path/to/*.json") as $file) {
    echo $file;

But this will print the path and the filename and I can't use getName() function. I'd like to use phalcon function like $file->getName() etc... as we can do when we are uploading some files like this :

foreach ($this->request->getUploadedFiles() as $file) {
     echo $file->getName(), " ", $file->getSize(), "\n";

There is a way to do this for the files in directory ? Or maybe I can't do that with Phalon and I have to use basename($file) ?

edited Mar '17 Next time use php docs/google really. Forum is mostly about phalcon questions.

edited Mar '17

Thanks for your answer. That was a question about Phalcon because I asked if there is this a Phalcon Class like Phalcon\Http\Request\File for directory file.

No because php have builtin class.