admin管理员组

文章数量:1394217

I saw somewhere someone talking about FileReader in JavaScript. What is it? What could be its use cases? Isn't it posing security problems, as it gives JavaScript access to disk?

  var temp = new FileReader();
  temp.onload = function(e){
      // Where did it load anything? 
  };

I saw somewhere someone talking about FileReader in JavaScript. What is it? What could be its use cases? Isn't it posing security problems, as it gives JavaScript access to disk?

  var temp = new FileReader();
  temp.onload = function(e){
      // Where did it load anything? 
  };
Share Improve this question asked Jul 7, 2011 at 5:18 Saeed NeamatiSaeed Neamati 35.9k42 gold badges139 silver badges192 bronze badges 1
  • now where did you see this? It could be javascript that is not running in a browser, you know.. – jrharshath Commented Jul 7, 2011 at 5:23
Add a ment  | 

2 Answers 2

Reset to default 5

This is an HTML5 feature. Check out the documentation here:

HTML5 FileReader

It's important to note that not all (IE) browser support this functionality.

FileReader on MDC. It's related to the HTML5 Blob and FileApi's. I'm pretty certain that a website can't just read random files, it can only read blobs that are basically user controlled (either from the site, or accessed via file APIs with consent)

本文标签: fileWhat is JavaScript FileReader and where it could be usedStack Overflow