Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit faebb61

Browse files
author
duzhiliang
committedMar 14, 2016
add custom key
1 parent d262144 commit faebb61

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var ReactQiniuDemo = React.createClass({
2020
return {
2121
files: [],
2222
token: 'YOUR_UPLOAD_TOKEN',
23+
uploadKey: 'YOUR_CUSTOM_UPLOAD_KEY', // Optional
2324
prefix: 'YOUR_QINIU_KEY_PREFIX' // Optional
2425
};
2526
},
@@ -49,7 +50,7 @@ var ReactQiniuDemo = React.createClass({
4950
render: function () {
5051
return (
5152
<div>
52-
<Qiniu onDrop={this.onDrop} size={150} token={this.state.token} onUpload={this.onUpload}>
53+
<Qiniu onDrop={this.onDrop} size={150} token={this.state.token} uploadKey={this.state.uploadKey} onUpload={this.onUpload}>
5354
<div>Try dropping some files here, or click to select files to upload.</div>
5455
</Qiniu>
5556
</div>

‎index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var ReactQiniu = React.createClass({
2424
multiple: React.PropTypes.bool,
2525
// Qiniu
2626
uploadUrl: React.PropTypes.string,
27+
uploadKey: React.PropTypes.string,
2728
prefix: React.PropTypes.string
2829
},
2930

@@ -107,6 +108,11 @@ var ReactQiniu = React.createClass({
107108
if (this.props.prefix) {
108109
key = this.props.prefix + key;
109110
}
111+
112+
if(this.props.uploadKey){
113+
key = this.props.uploadKey;
114+
}
115+
110116
var r = request
111117
.post(this.props.uploadUrl)
112118
.field('key', key)

0 commit comments

Comments
 (0)
Please sign in to comment.