AngularJS 大文件上传 angularQFileUpload

码农软件 · 软件分类 · AngularJS 扩展 · 2019-03-16 17:56:37

软件介绍

angularQFileUpload 是一个 AngularJS 扩展,实现了通过七牛云储存上传大文件的服务,支持恢复、进度等功能。

示例代码:

$scope.selectFiles = [];

var start = function (index) {
    $scope.selectFiles[index].progress = {
        p: 0
    };
    $scope.selectFiles[index].upload = $qupload.upload({
        key: '<your qiniu file key>',
        file: $scope.selectFiles[index].file,
        token: '<your qiniu UpToken>'
    });
    $scope.selectFiles[index].upload.then(function (response) {
        // upload success
        $log.info(response);
    }, function (response) {
        // upload failure
        $log.info(response);
    }, function (evt) {
        // progress
        $scope.selectFiles[index].progress.p = Math.floor(100 * evt.loaded / evt.totalSize);
    });
};

$scope.abort = function (index) {
    $scope.selectFiles[index].upload.abort();
    $scope.selectFiles.splice(index, 1);
};

$scope.onFileSelect = function ($files) {
    var offsetx = $scope.selectFiles.length;
    for (var i = 0; i < $files.length; i++) {
        $scope.selectFiles[i + offsetx] = {
            file: $files[i]
        };
        start(i + offsetx);
    }
};

本文地址:https://codercto.com/soft/d/1491.html

Programming Collective Intelligence

Programming Collective Intelligence

Toby Segaran / O'Reilly Media / 2007-8-26 / USD 39.99

Want to tap the power behind search rankings, product recommendations, social bookmarking, and online matchmaking? This fascinating book demonstrates how you can build Web 2.0 applications to mine the......一起来看看 《Programming Collective Intelligence》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具