问答详情
源自:1-2 客户端页面配置说明

如何我的上传界面显示文件后缀

<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Strict//EN' 'http://www.w3.org/TR/html4/strict.dtd'>

<html>

<head>

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>

<title>文件上传</title>

</head>

<body>

<form action="doaction.php" method="post" enctype="multipart/form-data">

请选择您要上传的文件:

<input type="file" name="myfile"/><br>

<input type="submit" value="上传文件"/>

</form>

</body>

</html>


提问者:慕UI4031390 2016-08-16 20:16

个回答

  • fengshunsgit
    2016-08-16 22:29:08
    已采纳

    <?PHP
        if(isset($_POST['submit'])) {
            $string = strrev($_FILES['upfile']['name']);
            $array = explode('.',$string);
            echo $array[0];
        }    
    ?>


  • qq_再见_33
    2018-01-31 10:41:24

    <?php

    $wjm="C:zhuomian/img/a.png";

    $string=substr($wjm,strrpos($wjm,"."));

    echo $string;

    echo '<hr>';

    //第二个

    function string(){

    $a="C:/meitu/img/p.text";

    $str=substr($a,strrpos($a,"."));

    return $str;

    }

    echo string();