查找上载文件的扩展名(PHP) [英] Finding Extension of uploaded file (PHP)
本文介绍了查找上载文件的扩展名(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
What's the best way/practice to get the extension of a uploaded file in PHP
我们可以从$ _FILES ["file"] ["tmp_name"]找出原始文件的扩展名吗?例如jpg或png等?谢谢.
Can We find out the extension of the original file from the $_FILES["file"]["tmp_name"] ? For example jpg or png etc? Thanks.
推荐答案
$name = $_FILES["file"]["name"];
$ext = end((explode(".", $name))); # extra () to prevent notice
echo $ext;
这篇关于查找上载文件的扩展名(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文