Quendian Posted June 11, 2009 Share Posted June 11, 2009 I am using a form to upload a file but I'm having trouble checking the file type. I only want the user to be able to upload .jpg and .jpeg file formats so I check the file type like so: if(($_FILES["file"]["type"] != "image/jpeg") || ($_FILES["file"]["type"] != "image/jpg")) { echo "Image not in correct format (". $_FILES["file"]["type"] . ")."; } But even when I upload an image with the correct file type it complains? How embarrassing, I fixed it. I was using the wrong operator in the if statement. I replaced it with && and it worked. Sorry. Link to comment https://forums.phpfreaks.com/topic/161823-solved-uploaded-file-type-checking/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.