Check Upload file type (multiple)

I would like to upload multiple files(image) to folder and I am storing image names to database image and image2 like that give any idea.
How can I check if a file extension and mime type are in an array this is the code I currently have.

This is my index code…


<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="image" /><br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<input type="file" name="image2" /><br />
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<input type="submit" id="submit" value="Upload" />
</form>

and this is my upload.php code.



function is_valid_type($file)
{
    // This is an array that holds all the valid image MIME types
    $valid_types = array("image/jpg", "image/jpeg", "image/bmp", "image/gif","image/png");

foreach ($_FILES['image'] as $file) {

    if (!in_array($file['type'], $valid_types))
        return 1;
    return 0;
}
}