Home >Backend Development >PHP Tutorial >PHP uses post method to obtain file extension, _PHP tutorial

PHP uses post method to obtain file extension, _PHP tutorial

WBOY
WBOYOriginal
2016-07-13 16:53:57955browse

php uses the post method to obtain the file extension,

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1052440.htmlTechArticlephp uses the post method to obtain the file extension, form action="" method="post" input type="file " value="" name="file" size="20" input type="submit" value="check"/form? php header ("Conte...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn