Possible Duplicate:
uploaded file type check by PHP
I used the below script for checking file type while uploading to restrict file uploading to only jpg/jpeg,png.But it doesnt work with IE(works with mozilla).So i need a script which works with all browsers.
$destination_path = getcwd().DIRECTORY_SEPARATOR;
$target_path = $destination_path . basename( $_FILES['myfile']['name']);
$types=array('image/png','image/jpeg');
if (in_array($_FILES['myfile']['type'], $types))
{
if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
$result = 1;
}
}
else
{
$result = 0;
}