Mac OSXでChrome12を使用しており、ドキュメントにjQuery1.6.1を含めています。
次の関数を使用して、ファイルの内容をテキストとして読み取り、データオブジェクトに保存しようとしています。
this.upload = function(file) {
console.log('FileHandler.upload called with ' + file.name + '.');
console.log(file);
console.log(this.reader);
data = {
content: this.reader.readAsText(file)
}
console.log('Content: ' + data.content);
}
「file」は有効なファイルオブジェクトであり、「this.reader」はFileReader型の新しいインスタンスです。このコードは、次のコンソール出力を作成します。
http://cl.ly/1Y2b383G2F272x1m1P0N