Skip to content

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