浏览Firefox不传递文件路径 [英] Getting around Firefox not passing the file path

查看:137
本文介绍了浏览Firefox不传递文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法,让Firefox过分拒绝传递使用输入文件元素选择的文件的完整路径。这个问题已经出现在多个其他论坛,我还没有找到任何有用的解决方案。



我想要的是一个手段,通过javascript,打开一个文件对话框(不使用愚蠢的你只是调用点击隐藏文件输入元素,因为这不解决任何问题)。然后,当用户选择一个文件,我把正式的文本字段中的完整路径。问题是:这是可行的吗?

如果不是的话,我不认为任何人知道一个方便的地方找到所有的属性和相关的函数来调用javascript文件对象。例如

 < input type =filename =file_uploadonchange =alert(this.items.item 0).some_property)> 

我找到了一个方便的列表这里,但我保持我的手指交叉,有一个属性对应于一个完整的文件路径(我知道,wishfull思想,我敢肯定)。无论如何,评论是非常感激(除非你只是告诉我停止抱怨的东西火狐无意修理)。

解决方案

为什么服务器需要知道客户端的完整路径?



不管为什么,这是有意的行为,因为暴露这种信息是一种安全风险。



这是不太可能改变的,任何你可能发现的解决方法都可能最终被浏览器作者关闭,因为它们是安全风险。 b $ b

I need a means of getting past Firefox's irritating refusal to pass the full path of a file selected using the input file element. This issue has come up in multiple other forums and I haven't found any solutions that are helpful.

What I want is a means, via javascript, to open a file dialog (without using the silly "hidden file input element that you just call click on" method because that doesn't solve anything). Then, when the user selects a file, I stow the full path in a regular text field. The question: is that feasible at all?

If not, I don't suppose anyone knows of a handy place to find all the properties and relevant functions to call on a javascript file object. For example

<input type="file" name="file_upload" onchange="alert(this.items.item(0).some_property)">

I found a handy list here but I'm keeping my fingers crossed that there's a property corresponding to a full file path (I know, wishfull thinking I'm sure). Anyways, comments are greatly appreciated (unless you just tell me to stop whining about something Firefox has no intention of fixing).

解决方案

Why would the server ever need to know the full path on the client?

Regardless of why, this is intentional behavior, as exposing this kind of information is a security risk.

It is highly unlikely to change, an any workarounds you may find may end up being shut down by browser writers as the security risks that they are.

这篇关于浏览Firefox不传递文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆