首页 > 你问我答 > 通过php怎么判断上传文件的类型呢?

通过php怎么判断上传文件的类型呢?

switch     ($_FILES['userfile']['type'])  
    {    
    case     "image/pjpeg":    
    $fileextname     =     "jpg";    
    break;    
    case     "image/gif":    
    $fileextname     =     "gif";    
    break;    
    case     "image/x-png":    
    $fileextname     =     "png";    
    break;    
    case     "application/x-shockwave-flash":    
    $fileextname     =     "swf";    
    break;    
    case     "text/plain":    
    $fileextname     =     "txt";    
    break;    
    case     "application/msword":    
    $fileextname     =     "doc";    
    break;    
    case     "application/x-zip-compressed":    
    $fileextname     =     "zip";    
    break;    
    }





你问我答->

发表评论

无觅相关文章插件,快速提升流量