Ive been experimenting with the upload capability of php, I have been looking at this tutorial on w3school.
http://www.w3schools.com/php/php_file_upload.asp
Your validation code is checking the extension, mime type and file size.
You are probably uploading a file with uppercase characters in the extension. When you check the extension, you checking it case sensitive, .JPG
is a valid image file extension, so you should make your check case insensitive:
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array(strtolower($extension), $allowedExts))
// ^ added strtolower()
If that isn't the immediate problem then the file is too big or has the wrong mime type. To debug, view the files array with:
print_r($_FILES);