I use the fileinfo pecl. http://pecl.php.net/Fileinfo how to get a mime type: $info = new finfo( FILEINFO_MIME ); $mime = $info->file($filename); then my extention grabber: function getExtention() { switch ( $this->mimeType ) { case "image/jpeg": return 'jpg'; break; case "image/png": return 'png'; break; case "image/gif": return 'gif'; break; default: throw new ImageTypeNotSupportedException(); } } This is all done in a Image Object. On Tuesday 22 November 2005 08:15 pm, twistednetadmin wrote: > I use this line in a script for uploading pictures to a website: > > $_FILES['guildimage']['type'] == "image/jpeg" > > This works fine when using Mozilla, but it doesn't work with IE. > How should I do it to get it working with both/all browsers? > > > > if (isset($_POST['submit'])) //If you > press submit > { > $sysfolder="/guildimages/"; > $filename="".$_FILES['guildimage']['name'].""; > > if (file_exists($sysfolder . $filename)) //And the > file exists or there is no file chosen > { > echo "Filename exists or no file selected. Please rename the file or > select a file"; > > } > elseif ($_FILES['guildimage']['type'] == "image/jpeg") //If > the filetype is correct (this is where the change should be I think) > { > > copy ($_FILES['guildimage']['tmp_name'], > "/guildimages/".$_FILES['guildimage']['name']) //Copy the file > to folder ("/guildimages") > or die("Could not copy file"); //Or > die > > echo "Result:<br>\n"; > echo "Filename: ".$_FILES['guildimage']['name']."<br>\n"; > echo "Filesize: ".$_FILES['guildimage']['size']." byte<br>\n"; > echo "Filtype: ".$_FILES['guildimage']['type']."<br>\n"; > echo "Congrats! It worked!\n"; > } > else > { > > echo "Result:<br>\n"; > echo "Now that didn't seem to work... <br>\n > Have you checked the size and filetype? <br>\n > File that failed--> (".$_FILES['guildimage']['name'].")<br>"; > > } > } > > Does anyone know the answer to this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php