Im uploading with the fileReference and want to check the mime type for security reasons.

The php code work in a regular html/php form but the same code doesnt work with the swf file, when I comment out the mime checking code it also works i flash.

Anybody know why this happens?

$fil = $_FILES['Filedata']['name'];
if (preg_match("/\.(?:txt|doc|pdf)$/i", $fil)){   $mime = $_FILES['Filedata']['type']; 
  //this doesnt work from flash!
 $mime = $_FILES['Filedata']['type']; 
  if($mime == "application/msword" || $mime == "text/plain" || $mime == "application/pdf") { 
 move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);