JohnMeyer > if (is_uploaded_file($_FILES["imagefile"]["tmp_name"]) && > ($_FILES["imagefile"]["type"] != "image/jpeg" && > $_FILES["imagefile"]["type"] != "image/gif" && $_FILES["imagefile"]["type"] > != "image/jpg" && $_FILES["imagefile"]["type"] != "image/png")) > > I'm trying to weed out everything that isn't a .jpg, .gif, or .png. What's > wrong with this?
=when you have a complex question, simplify! =It would be called the KISS principle if you were better looking! =It doesn't seem to be bothering you, so let's assume that the is_uploaded section works. =First let's plug in an imagefile-type of .TIF TIF != "image/jpeg" is true TIF != "image/gif" is true TIF != "image/jpg" is true TIF != "image/png" is true =So true AND true AND true AND true is true, and presumably you will "weed out" that file***. But... =next let's plug in an imagefile-type of .GIF TIF != "image/jpeg" is true TIF != "image/gif" is false TIF != "image/jpg" is true TIF != "image/png" is true =So true AND false AND true AND true is false, and presumably you will "weed in" that file***. But... =Let's come back to that first phrase that looked so good: is_uploaded_file($_FILES["imagefile"]["tmp_name"]) =(***with such limited visibility as you have afforded us - an incomplete PHP statement -> cries of "unfair" are heard in the land!) It seems that if this is an uploaded file the logic will result in true, but if it is not, false. =Now add that to the above: our .TIF resulted in true so an uploaded file that is in .TIF format will be weeded out. But... =our .GIF resulted in false so regardless of whether we have an uploaded file or not, the result of the ANDs must be false! In other words, a JP(e)G, GIF, or .PNG file will be treated in the same way as a non-uploaded file!? Should the is_uploaded_file() question be separated from the question about the (un)acceptable types of file? =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php