HTML5的FileReader接口封裝 - FileReader.js

jopen 12年前發布 | 49K 次閱讀 HTML5 前端技術

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) {

        }
    }
};

項目主頁:http://www.baiduhome.net/lib/view/home/1338651006609

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!