·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> php使用post方式获得文件扩展名

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

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23
<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];        
    }
?>