Illegal offset type
- by BFTrick
Hello,
I am having trouble uploading a file through php. I check the file type at the beginning of the process and I get an error.
This is the error I am getting:
Warning: Illegal offset type in
/balblabla/DBfunctions.inc.php on line
183
This is the printed out $_FILES var
Array ( [Picture] = Array ( [name] =
JPG.jpg [type] = image/jpeg
[tmp_name] = /tmp/phpHlrNY8 [error]
= 0 [size] = 192221 ) )
Here is the segment of code I am using that is giving me issues:
function checkFile($file, $type)
{
if( in_array($_FILES[$file]['type'], $type) ){ // <--- LINE 183
return true;
}//if
return false;
} // end checkFile()
This is the line of code that calls the function
if( checkFile( $_FILES['Picture'], array("image/jpeg") ) == true ){
//do stuff
}// end if
I have used this piece of code on dozens of websites on my own server so i am guessing that this is some different configuration option. How can i modify my code so that it works on this different server?