I use jQuery if this is useful; and I would like to have:
The user selects a file in the local file system
my javascript gets the contents of the specified file without going through the wire.
I check the type of browser and am ready to use completely different code for each browser. IE and FF are the ones I'm writing to.
I do not use php, just direct javascript on the form.
I do not want to receive, send, send, ajax or any other network activity until the contents of the file are received, verified and processed (all my actions will be a script; the question is only to get the guts of the file).
I don’t have to go all the way. I don’t really want to get the way. The generally accepted concept is "safe" when the user selects a file and my script simply receives the contents. This is good, but if I get the way, I will not complain.
I googled a lot and did not get any solution that just works.
I looked at Mozilla XPCOM , but the nsIFilePicker file collector requires privilege escalation, which I just don't want to deal with.
I tried using ordinary
<input type="file" onclick="fileCheck(this); return false" . . . />
with
function fileCheck ()
{
var path = obj.files[0].mozFullPath;
}
But even if you see mozFullPath in Firebug, it does not appear for Javascript (supposedly for security reasons).
Any ideas?
source
share