I just bought a myspace turnkey script. It has an option to upload pictures but I keep getting this error. Warning: array_search() [function.array-search]: Wrong datatype for second argument in /home/****/public_html/admincp/upload2.php on line 35 Invalid image file type! Code (markup): I have no idea what this is. The instructions for the script said nothing about this. This is what is in line 35. { if (array_search(strtolower(substr($file['name'], strrpos($file['name'], '.')+1)), $config['ftypes']) == false) { echo "<B>Invalid image file type!</B>"; exit; } Code (markup): Anyone have any suggestions?
I tried uploading jpg gif and pngs. All say the same thing. Can you give me an example on how you would edit that line?
There is error in 2nd arguement i-e $config['ftypes']. Verify the contents of this array by echoing it.
Try adding the following two lines just before the if-statements. echo "File Types are: ".$config['ftypes']; exit(); Code (markup): Your code will look like the following: { echo "File Types are: ".$config['ftypes']; exit(); if (array_search(strtolower(substr($file['name'], strrpos($file['name'], '.')+1)), $config['ftypes']) == false) { echo "<B>Invalid image file type!</B>"; exit; } PHP: It will display value of the array. What do you get after you execute this code?
i think it has a wrong definition on your config file, find the declaration of $config["ftypes"], in config.php $config['ftypes'] = array('dumb','jpg','jpeg','png','gif','bmp');