Skip to content

Commit 71a9e9d

Browse files
committed
update readme
1 parent 5564f8b commit 71a9e9d

File tree

4 files changed

+33
-48
lines changed

4 files changed

+33
-48
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ qiniu-js-sdk
5555
* 初始化上传
5656
5757
```javascript
58-
58+
var Qiniu = new QiniuJsSDK();
5959
var uploader = Qiniu.uploader({
6060
runtimes: 'html5,flash,html4', //上传模式,依次退化
6161
browse_button: 'pickfiles', //上传选择的点选按钮,**必需**
@@ -132,6 +132,25 @@ qiniu-js-sdk
132132
// domain 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取
133133
134134
// uploader 为一个plupload对象,继承了所有plupload的方法,参考http://plupload.com/docs
135+
136+
```
137+
138+
如果一个页面中有多个上传实例,可以如下操作
139+
```javascript
140+
var Qiniu = new QiniuJsSDK();
141+
var op1 = {
142+
key : val ,
143+
……
144+
};
145+
var uploader = Qiniu.uploader(op1);
146+
147+
var Qiniu2 = new QiniuJsSDK();
148+
var op1 = {
149+
key : val ,
150+
……
151+
};
152+
var uploader2 = Qiniu2.uploader(op2);
153+
135154
```
136155
137156
* 运行网站,通过点击`pickfiles`元素,选择文件后上传

demo/js/multiple.js

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@ $(function() {
1717
chunk_size: '4mb',
1818
uptoken_url: $('#uptoken_url').val(),
1919
domain: $('#domain').val(),
20-
// downtoken_url: '/downtoken',
21-
// unique_names: true,
22-
// save_key: true,
23-
// x_vars: {
24-
// 'id': '1234',
25-
// 'time': function(up, file) {
26-
// var time = (new Date()).getTime();
27-
// // do something with 'time'
28-
// return time;
29-
// },
30-
// },
3120
auto_start: true,
3221
init: {
3322
'FilesAdded': function(up, files) {
@@ -59,17 +48,11 @@ $(function() {
5948
progress.setComplete(up, info);
6049
},
6150
'Error': function(up, err, errTip) {
62-
$('table').show();
63-
var progress = new FileProgress(err.file, 'fsUploadProgress');
64-
progress.setError();
65-
progress.setStatus(errTip);
66-
}
67-
// ,
68-
// 'Key': function(up, file) {
69-
// var key = "";
70-
// // do something with key
71-
// return key
72-
// }
51+
$('table').show();
52+
var progress = new FileProgress(err.file, 'fsUploadProgress');
53+
progress.setError();
54+
progress.setStatus(errTip);
55+
}
7356
}
7457
});
7558

@@ -89,17 +72,6 @@ $(function() {
8972
chunk_size: '4mb',
9073
uptoken_url: $('#uptoken_url').val(),
9174
domain: $('#domain').val(),
92-
// downtoken_url: '/downtoken',
93-
// unique_names: true,
94-
// save_key: true,
95-
// x_vars: {
96-
// 'id': '1234',
97-
// 'time': function(up, file) {
98-
// var time = (new Date()).getTime();
99-
// // do something with 'time'
100-
// return time;
101-
// },
102-
// },
10375
auto_start: true,
10476
init: {
10577
'FilesAdded': function(up, files) {
@@ -131,22 +103,16 @@ $(function() {
131103
progress.setComplete(up, info);
132104
},
133105
'Error': function(up, err, errTip) {
134-
$('table').show();
135-
var progress = new FileProgress(err.file, 'fsUploadProgress');
136-
progress.setError();
137-
progress.setStatus(errTip);
138-
}
139-
// ,
140-
// 'Key': function(up, file) {
141-
// var key = "";
142-
// // do something with key
143-
// return key
144-
// }
106+
$('table').show();
107+
var progress = new FileProgress(err.file, 'fsUploadProgress');
108+
progress.setError();
109+
progress.setStatus(errTip);
110+
}
145111
}
146112
});
147113

148114
uploader2.bind('FileUploaded', function() {
149-
console.log('hello man,a file is uploaded');
115+
console.log('hello man 2,a file is uploaded');
150116
});
151117

152118
$('#container').on(

demo/views/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h4 class="modal-title" id="myModalLabel">查看初始化代码</h4>
8686
<div class="modal-body">
8787
<pre><code>
8888
//引入Plupload 、qiniu.js后
89-
89+
var Qiniu = new QiniuJsSDK();
9090
var uploader = Qiniu.uploader({
9191
runtimes: 'html5,flash,html4', //上传模式,依次退化
9292
browse_button: 'pickfiles', //上传选择的点选按钮,**必需**

demo/views/multiple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ <h4 class="modal-title" id="myModalLabel">查看初始化代码</h4>
9292
<div class="modal-body">
9393
<pre><code>
9494
//引入Plupload 、qiniu.js后
95-
95+
var Qiniu = new QiniuJsSDK();
9696
var uploader = Qiniu.uploader({
9797
runtimes: 'html5,flash,html4', //上传模式,依次退化
9898
browse_button: 'pickfiles', //上传选择的点选按钮,**必需**

0 commit comments

Comments
 (0)