<form action="" method="post">
    <input type="file" value="" name="file" size="20">
    <input type="submit" value="check">
</form>
<?php
    header("Content-type:text/html;charse=utf8");
    if(isset($_POST['file'])){
        $pic = $_POST['file'];
        $pics = explode(".", $pic);
        echo "上传文件的扩展名为:".$pics[count($pics)-1];        
    }
?>

php使用post方式获得文件扩展名

相关文章: