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 e 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, ments are greatly appreciated (unless you just tell me to stop whining about something Firefox has no intention of fixing).
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 e 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, ments are greatly appreciated (unless you just tell me to stop whining about something Firefox has no intention of fixing).
Share Improve this question asked Jul 19, 2010 at 18:54 JDSJDS 1,3594 gold badges17 silver badges29 bronze badges 3- 6 Why are you trying to circumvent a security feature of the browser? This is NOT a <del>TUMOR</del> BUG. – meder omuraliev Commented Jul 19, 2010 at 18:57
- 4 The server should never require the full path to the client file. You're trying to do something that shouldn't be done, and there isn't any work around for it. – Chris Commented Jul 19, 2010 at 18:58
- 3 Stop whining about something Firefox has no intention of changing. ;-) But seriously, browser security features are annoying but important. – Byron Whitlock Commented Jul 19, 2010 at 18:59
2 Answers
Reset to default 6Why 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.
This is an intentional security feature and unlikely to go away.
Internet Explorer 8 does the same thing now:
Additionally, the “Include local directory path when uploading files” URLAction has been set to "Disable" for the Internet Zone. This change prevents leakage of potentially sensitive local file-system information to the Internet. For instance, rather than submitting the full path C:\users\ericlaw\documents\secret\image.png, Internet Explorer 8 will now submit only the filename image.png.
Flash-based uploaders like SWFUpload should be able to store the full path with some tweaking.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744392245a4571965.html
评论列表(0条)