- Oct 21, 2003
- 99
- 0
- 0
I am trying to create a function which would take a filename and determine whether or not it is an image based on a defined array or file extensions:
function IsImage($filename)
{
$file_info = pathinfo($filename);
$file_extension = $file_info["extension"];
if (!in_array($file_extension, $file_exts)) return false;
else return true;
}
This would search an array of file extensions for the extension of the passed in variable. But when I try the function, I get the error
Warning: Wrong datatype for second argument in call to in_array in <B>c:\apache\htdocs\phpgallery\index.php</B> on line <B>71</B>
function IsImage($filename)
{
$file_info = pathinfo($filename);
$file_extension = $file_info["extension"];
if (!in_array($file_extension, $file_exts)) return false;
else return true;
}
This would search an array of file extensions for the extension of the passed in variable. But when I try the function, I get the error
Warning: Wrong datatype for second argument in call to in_array in <B>c:\apache\htdocs\phpgallery\index.php</B> on line <B>71</B>