当前位置: 首页 > 工具软件 > FileReader.js > 使用案例 >

html5的filereader,HTML5的FileReader接口封装 – FileReader.js

方夜洛
2023-12-01

FileReader.js 封装了 HTML5 的 FileReader interface ,使用上更加简单。

浏览器支持:

Internet Explorer: 10+

Firefox: 10+

Chrome: 13+

Opera: 12+

Safari: partial

var opts = {

dragClass: "drag",

accept: false,

readAsMap: {

'image/*': 'DataURL',

'text/*' : 'Text'

},

readAsDefault: 'BinaryString',

on: {,

beforestart: function(e, file) {

// return false if you want to skip this file

},

loadstart: function(e, file) {

// Native ProgressEvent

},

progress: function(e, file) {

// Native ProgressEvent

},

load: function(e, file) {

// Native ProgressEvent

},

error: function(e, file) {

// Native ProgressEvent

},

loadend: function(e, file) {

// Native ProgressEvent

},

abort: function(e, file) {

// Native ProgressEvent

},

skip: function(e, file) {

// Called when a file is skipped. This happens when:

// 1) A file doesn't match the accept option

// 2) false is returned in the beforestart callback

},

groupstart: function(group) {

},

groupend: function(group) {

}

}

};

扩展阅读:

 类似资料: