Giter VIP home page Giter VIP logo

big-file-uploader's Introduction

BigFileUploader

通过文件分片解决大文件上传的问题

用法

  • 引入 JS 文件
<script type="text/javascript" src="//code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="../src/BigFileUploader.js"></script>
  • 与 file 控件绑定
$('#button').click(function () {
    (new BigFileUploader($('#file').get(0), {
        url: './upload.php',
        error: function (o) {
            alert(o.message);
        },
        success: function (o) {
            alert(o.message);
        },
        progress: function (o) {
            console.log(o.percent);
            $('#progressBar').css('width', o.percent + '%');
        }
    })).start();
})

选项

blockSize

文件块大小,单位 MB。默认值为 10

url

服务端接口地址

error

发生错误时的回调

success

文件成功上传时的回调

progress

文件上传进度发生变化时的回调

big-file-uploader's People

Contributors

fising avatar dong-zeyu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.