if ($_FILES['file']['type'] == 'image/jpeg') or ($_FILES['file']['type'] == 'image/gif') or
($_FILES["file"]["type"] == "image/png")
The code above permits jpeg, gif, and png.
I like to add “mov” to the code above.
But the code below doesn’t work I expected.
if ($_FILES['file']['type'] == 'image/jpeg') or ($_FILES['file']['type'] == 'image/gif') or
($_FILES["file"]["type"] == "image/png") OR ($_FILES['file']['type'] == 'image/mov')
The code below also doesn’t work.
if ($_FILES['file']['type'] == 'image/jpeg') or ($_FILES['file']['type'] == 'image/gif') or
($_FILES["file"]["type"] == "image/png") OR ($_FILES['file']['type'] == 'movie/mov')
What you should do instead is take the mime type that comes in, find what extension belong to that mime type and then rename the file to ensure it really has that mime type.
That way people can never pass off .exe files as an image (and yes, that is possible), because you’ll rename if from .exe to .jpg for example.