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