Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add function getKey #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add function getKey #9

wants to merge 1 commit into from

Conversation

oldfeel
Copy link

@oldfeel oldfeel commented Mar 29, 2016

upload: function(file) {
    if (!file || file.size === 0) 
        return null;
    var key = file.preview.split('/').pop() + '.' + file.name.split('.').pop();
    if (this.props.prefix) {
        key = this.props.prefix + key;
    }

    if (this.props.uploadKey) {
        key = this.props.uploadKey;
    }
    this.setState({key: key})

    var r = request.post(this.props.uploadUrl).field('key', key).field('token', this.props.token).field('x:filename', file.name).field('x:size', file.size).attach('file', file, file.name).set('Accept', 'application/json');
    if (isFunction(file.onprogress)) {
        r.on('progress', file.onprogress);
    }
    return r;
},

getKey: function() {
    return this.state.key
},

return fn && getType.toString.call(fn) === '[object Function]';
var isFunction = function(fn) {
var getType = {};
return fn && getType.toString.call(fn) === '[object Function]';
Copy link
Owner

@lenage lenage Jul 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oldfeel whitespace 清一下吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants