Page 1 of 1

Can't use finfo_file()?

Posted: Thu May 29, 2008 2:03 pm
by Chalks
I'm building an image uploader as a small project, and ran across some issues when trying to validate the files. Here's the error I'm getting: "Fatal error: Call to undefined function finfo_open() in /home/chalks/public_html/test/backend.php on line 33". Why is that happening?

Also: after searching devnetwork, google, and the php manual I've come across these methods for validating files:
finfo_file()
something with the image library (get image size?)
check file extensions (not very good way to validate, but might as well throw it in too)

Are there other methods for validation? Right now I'm testing on a linux server, but I'm going to have to put this on a windows server too. :(

Re: Can't use finfo_file()?

Posted: Thu May 29, 2008 2:38 pm
by nowaydown1
Sounds like the PECL extension isn't enabled on your PHP installation. That function isn't part of the base PHP install. Installation instructions for the extension can be found here:

http://us.php.net/manual/en/fileinfo.installation.php

Re: Can't use finfo_file()?

Posted: Thu May 29, 2008 4:42 pm
by pickle
getimagesize() is most often used to verify if a file is an image.