2

Is there no way for javascript hosted on a webserver to read a file on a client's local machine? (this has obvious security risks). I guess I'm wondering if there's any access granting a user can do, like drag and dropping a file into the browser, or explicitly selecting a file from a popup to get around this?

I know flash 10 allows reading of a local file, just wondering if there were any method to do this in javascript.

Thanks

user246114
  • 50,223
  • 42
  • 112
  • 149

4 Answers4

2

Who on their right mind would release a browser that let JS to... oh wait, you can with activeX, but only works with IE.

Ben
  • 16,275
  • 9
  • 45
  • 63
  • More specifically, it's the Scripting.FileSystemObject ActiveX Object that lets you do this. – Matt Apr 03 '10 at 09:47
2

... or explicitly selecting a file from a popup to get around this ...

You could of course just upload the file to your server then...

ChristopheD
  • 112,638
  • 29
  • 165
  • 179
2

There is new File API being a working draft in W3C, and it is already implemented in Firefox 3.6, see

http://demos.hacks.mozilla.org/openweb/FileAPI/
http://ajaxian.com/archives/w3c-publish-first-working-draft-of-file-api
http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/

Tim Babych
  • 3,356
  • 1
  • 20
  • 13
1

Nope, that's not possible...

However, see this:

http://www.mozilla.org/js/js-file-object.html

Community
  • 1
  • 1
Sarfraz
  • 377,238
  • 77
  • 533
  • 578