| | |
| | | } |
| | | } |
| | | |
| | | getExtraData = file => { |
| | | const param = new FormData() |
| | | param.append('file', file) |
| | | param.append('RootPath', 'Content/images/upload/') |
| | | |
| | | return param |
| | | getExtraData = () => { |
| | | return { |
| | | RootPath: 'Content/images/upload/' |
| | | } |
| | | } |
| | | |
| | | shardupload = (file, shardSize, shardCount, i) => { |
| | |
| | | if (i < shardCount) { |
| | | i++ |
| | | Api.getFileUpload(file).then(res => { |
| | | console.log(res) |
| | | if (res) { |
| | | this.setState({ |
| | | percent: Math.floor(100 * (i / shardCount)) |
| | |
| | | |
| | | beforeUpload = (file, fileList) => { |
| | | let shardSize = 200 * 1024 * 1024 |
| | | console.log(file) |
| | | // console.log(file) |
| | | |
| | | if (file.size > shardSize) { |
| | | this.setState({ |
| | |
| | | fileList: value, |
| | | action: baseUrl, |
| | | method: 'post', |
| | | multiple: true, |
| | | // headers: {'RootPath': 'Content/images/upload/'}, |
| | | onChange: this.onChange, |
| | | onRemove: this.onRemove, |
| | | data: this.getExtraData, |
| | |
| | | return ( |
| | | <Upload {...props}> |
| | | <Button> |
| | | <Icon type="upload" /> Click to Upload |
| | | <Icon type="upload" /> 点击上传 |
| | | </Button> |
| | | {showprogress ? <Progress percent={percent} size="small" /> : null} |
| | | </Upload> |