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

uploading files, file types

I wanted to secure the upload to only upload images. I could filter on the '.jpg/.png....' but, is there no property 'file type', or standard filter?

Phalcon\Http\Request\File Object ( [_name:protected] => 70638-Energy.jpg [_tmp:protected] => /tmp/phpYfs2H2 [_size:protected] => 671834 )

thanks Raymond



4.1k

I could use this:

$extension = end(explode(".", $file->getName()));

and than filter...

Raymond