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
  • 48,235
  • 41
  • 111
  • 147

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
  • 15,578
  • 8
  • 42
  • 61
  • 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
  • 106,997
  • 27
  • 158
  • 177
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,238
  • 1
  • 19
  • 12
1

Nope, that's not possible...

However, see this:

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

Community
  • 1
  • 1
Sarfraz
  • 367,681
  • 72
  • 526
  • 573