简体   繁体   English

如何获取升级文件的客户端路径

[英]how to get client side path of the uploded file

I have a form that uploads files, i need to get client side path to file? 我有上传文件的表单,我需要获取文件的客户端路径吗?
server path i could get from php array $_FILES 我可以从php数组$ _FILES获得的服务器路径

$_FILES["UploadFileName"]["tmp_name"]

how to get client side path to file stored on a client computer? 如何获取存储在客户端计算机上的文件的客户端路径?

<form method="POST" action="upload.php" enctype="multipart/form-data">
    <p>File to upload : <input type ="file" name = "UploadFileName"></p><br />
    <input type = "submit" name = "Submit" value = "Press THIS to upload">
</form>

You can't. 你不能 That's a security matter and the browsers will not provide that to you. 这是安全问题,浏览器不会为您提供。

How to get client side path to file stored on a client computer? 如何获取存储在客户端计算机上的文件的客户端路径?

It is not allowed for security reasons.If this were possible, an attacker could gain information regarding how files/folders were structured on a client computer. 出于安全原因, 不允许这样做。如果可能,攻击者可以获得有关客户端计算机上文件/文件夹的结构信息。 Any fully trusted code on users' machine can do that. 用户计算机上的任何完全受信任的代码都可以做到这一点。 So your goal is to convince user to install something that will provide you with the information. 因此,您的目标是说服用户安装可以为您提供信息的产品。

For Windows (all require installation of some sort): 对于Windows(均需要某种安装):

  • ActiveX controls ActiveX控件
  • Native EXE 本机EXE
  • Locally installed managed EXE 本地安装的托管EXE
  • locally installed HTA for IE only 仅针对IE本地安装的HTA

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM