【文件属性】:
文件名称:AngularJS大文件上传angularQFileUpload.zip
文件大小:8KB
文件格式:ZIP
更新时间:2022-08-07 22:21:25
开源项目
angularQFileUpload 是一个 AngularJS 扩展,实现了通过七牛云储存上传大文件的服务,支持恢复、进度等功能。示例代码:$scope.selectFiles = [];
var start = function (index) {
$scope.selectFiles[index].progress = {
p: 0
};
$scope.selectFiles[index].upload = $qupload.upload({
key: '',
file: $scope.selectFiles[index].file,
token: ''
});
$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);
}
};
【文件预览】:
angularQFileUpload-master
----LICENSE(1KB)
----src()
--------qupload.js(7KB)
----.gitignore(997B)
----demo()
--------index.html(1KB)
--------app.js(1KB)
----README.md(2KB)
----bower.json(709B)