以上面的图片为例子
//我们这里需要使用到 $_FILE echo "<pre>"; print_r($_FILES); echo $_SERVER['DOCUMENT_ROOT']."<br />";//获取文件服务器的根目录。 echo dirname(__FILE__)."<br />";//获取当前文件的目录; echo __FILE__."<br/>";//获取当前文件的目录和文件名。 echo basename(__FILE__);//获取当前文件的目录和文件名。 echo "</pre>";
浏览器输出结果为:
Array ( [myfile] => Array ( [name] => bao.jpg [type] => image/jpeg [tmp_name] => D:wamp mpphpF1A3.tmp [error] => 0 [size] => 55135 ) ) D:/wamp/www/
D:wampwww 01
D:wampwww 01uploadprocess.php
uploadprocess.php