0

I am using a forms.FileField to have the user choose file to open. I need to know which path the user chose in addition to the filename. I can't seem to find that anyplace. I will be loading other files from the same path.

4

1 回答 1

2

不发送客户端(用户计算机)上的路径。

您不能从同一路径加载文件 - 除非您有一些客户端代码(如 java applet 或 flash 应用程序)具有适当的安全权限来打开客户端计算机上的文件,然后通过 TCP 连接将文件发送到您的服务器 -你没有。

所以总而言之,客户端计算机上的文件路径在使用文件上传字段时不可用,使用任何服务器端语言。

了解更多信息:

  1. RFC 2388(规范)
  2. 如何从html输入表单中获取文件路径
  3. W3C 表格参考
于 2012-01-04T04:57:39.817 回答