Skip to content

Commit d3c07d1

Browse files
committed
init
1 parent 2d073a2 commit d3c07d1

File tree

5 files changed

+446
-0
lines changed

5 files changed

+446
-0
lines changed

.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Go Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# JAVA
7+
*.class
8+
9+
# Folders
10+
_obj
11+
_test
12+
_build
13+
_bin
14+
15+
# Architecture specific extensions/prefixes
16+
*.[568vq]
17+
[568vq].out
18+
19+
*.cgo1.go
20+
*.cgo2.c
21+
_cgo_defun.c
22+
_cgo_gotypes.go
23+
_cgo_export.*
24+
25+
_testmain.go
26+
27+
*.exe
28+
*.cache
29+
*.chunked
30+
*.logger
31+
*.class
32+
33+
# bundler
34+
.bundle
35+
36+
# jeweler generated
37+
pkg
38+
bin
39+
40+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
41+
#
42+
# * Create a file at ~/.gitignore
43+
# * Include files you want ignored
44+
# * Run: git config --global core.excludesfile ~/.gitignore
45+
#
46+
# After doing this, these files will be ignored in all your git projects,
47+
# saving you from having to 'pollute' every project you touch with them
48+
#
49+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
50+
#
51+
# For MacOS:
52+
#
53+
.DS_Store
54+
55+
# For vim:
56+
*.swp
57+
58+
bower_components
59+
.tmp
60+
node_modules
61+
.idea
62+
design
63+
test
64+
*.test

bower.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "angularQFileUpload",
3+
"version": "0.1.4",
4+
"homepage": "http://github.com/icattlecoder/angularQFileUpload",
5+
"authors": [
6+
"icattlecoder <icattlecoder@gmail.com>"
7+
],
8+
"description": "AngularJS qiniu cloud storage large file upload service with support resumble,progress",
9+
"main": "./src/qupload.js",
10+
"keywords": [
11+
"AngularJS",
12+
"Angular",
13+
"Storage",
14+
"Qiniu",
15+
"Qiniu upload"
16+
],
17+
"license": "MIT",
18+
"ignore": [
19+
"src",
20+
"node_modules",
21+
"bower_components",
22+
"test",
23+
"tests",
24+
"Gruntfile.js"
25+
],
26+
"devDependencies": {
27+
"angularjs": "*",
28+
"angular-mocks": "~1.2.1"
29+
}
30+
}

demo/app.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use strict';
2+
3+
/**
4+
* @ngdoc function
5+
* @name qiniuUploadApp.controller:MainCtrl
6+
* @description
7+
* # MainCtrl
8+
* Controller of the qiniuUploadApp
9+
*/
10+
angular.module('qiniuUploadApp', ['angularQFileUpload', 'LocalStorageModule'])
11+
.controller('MainCtrl', function ($scope, $log, $qupload) {
12+
13+
$scope.selectFiles = [];
14+
15+
var start = function (index) {
16+
$scope.selectFiles[index].progress = {
17+
p: 0
18+
};
19+
$scope.selectFiles[index].upload = $qupload.upload({
20+
key: '124/1414748783948772378/网站-首页-01.png',
21+
file: $scope.selectFiles[index].file,
22+
token: 'IT9iP3J9wdXXYsT1p8ns0gWD-CQOdLvIQuyE0FOK:ZM79I8EtrxY4T2n47p5rhCQiWDg=:eyJzY29wZSI6ImZvb29vb29vb29vbzoxMjQvMTQxNDc0ODc4Mzk0ODc3MjM3OC_nvZHnq5kt6aaW6aG1LTAxLnBuZyIsImRlYWRsaW5lIjoxNDE0ODM1MTgzLCJmc2l6ZUxpbWl0Ijo1MjQyODgwMH0='
23+
});
24+
$scope.selectFiles[index].upload.then(function (response) {
25+
$log.info(response);
26+
}, function (response) {
27+
$log.info(response);
28+
}, function (evt) {
29+
$scope.selectFiles[index].progress.p = Math.floor(100 * evt.loaded / evt.totalSize);
30+
});
31+
};
32+
33+
$scope.abort = function (index) {
34+
$scope.selectFiles[index].upload.abort();
35+
$scope.selectFiles.splice(index, 1);
36+
};
37+
38+
$scope.onFileSelect = function ($files) {
39+
var offsetx = $scope.selectFiles.length;
40+
for (var i = 0; i < $files.length; i++) {
41+
$scope.selectFiles[i + offsetx] = {
42+
file: $files[i]
43+
};
44+
start(i + offsetx);
45+
}
46+
};
47+
});

demo/index.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!doctype html>
2+
<html class="no-js">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>angular qiniu cloud storage uploader</title>
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width">
9+
</head>
10+
11+
<body ng-app="qiniuUploadApp">
12+
<!--[if lt IE 7]>
13+
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
14+
<![endif]-->
15+
<div ng-controller="MainCtrl">
16+
17+
<div ng-file-select="onFileSelect($files)" data-multiple="true" title="select file" onclick="this.value = null" class="btn btn-upload">Click here to select file</div>
18+
<ol>
19+
<li ng-repeat="(k,v) in selectFiles">
20+
{{v.file.name}} - {{v.progress.p}} <button ng-click="abort(k)">xx</button>
21+
</li>
22+
</ol>
23+
</div>
24+
25+
26+
<!--[if lt IE 9]>
27+
<script src="bower_components/es5-shim/es5-shim.js"></script>
28+
<script src="bower_components/json3/lib/json3.min.js"></script>
29+
<![endif]-->
30+
31+
<!-- build:js(.) scripts/vendor.js -->
32+
<!-- bower:js -->
33+
<script src="bower_components/angular/angular.js"></script>
34+
<script src="bower_components/angular-local-storage/dist/angular-local-storage.js"></script>
35+
<script src="../src/qupload.js"></script>
36+
37+
<!-- endbower -->
38+
<!-- endbuild -->
39+
40+
<!-- build:js({.tmp,app}) scripts/scripts.js -->
41+
<script src="app.js"></script>
42+
<!-- endbuild -->
43+
</body>
44+
45+
</html>

0 commit comments

Comments
 (0)