刘华世的官方博客

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

<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];        
    }
?>

posted @ 2015-09-08 15:51  刘华世的博客  阅读(463)  评论(0编辑  收藏  举报
刘华世的官方博客