本文介绍了上传后获取服务器上文件的客户端路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道所选文件的REALPATH.就像我上传图片一样.我想知道 F:\ ubuntu \ Ubuntu.ico .
I want to know the REALPATH of selected file. Like I uploaded the image. I want to know F:\ubuntu\Ubuntu.ico.
这是我的代码:
<pre>
<?php
print_r($_FILES);
?>
</pre>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="fupload" id="fupload" />
<input type="submit" value="Upload" />
</form>
Output:
Array
(
[fupload] => Array
(
[name] => Ubuntu.ico
[type] => image/x-icon
[tmp_name] => D:\xampp\tmp\php89.tmp
[error] => 0
[size] => 1150
)
)
推荐答案
您不知道客户端系统上的完整路径.大多数浏览器根本不会将该信息公开给网页.提供这些信息可以公开有关客户端系统的信息(例如,用户名,已安装的软件包),并且知道路径的服务器用例很少.
You can't know the full path on the client system. Most browsers simply do not expose that information to webpages. Giving that information can expose information about the client system (e.g. usernames, installed software packages) and the usecases for the server knowing the path are very rare.
这篇关于上传后获取服务器上文件的客户端路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!