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

Upload 分片上传 #25929

Open
1 task done
zerox-v opened this issue Jul 31, 2020 · 9 comments
Open
1 task done

Upload 分片上传 #25929

zerox-v opened this issue Jul 31, 2020 · 9 comments
Labels
help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. Inactive

Comments

@zerox-v
Copy link

zerox-v commented Jul 31, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

请问Upload 有计划支持分片上传吗?现在上传文件要是太大了的话会超时,导致文件上传失败。

What does the proposed API look like?

添加如下属性

chunked {boolean} [可选] [默认值:false] 是否要分片处理大文件上传。
chunkSize {number} [可选] [默认值:5242880] 如果要分片,分多大一片? 默认大小为5M.
chunkRetry {number} [可选] [默认值:2] 如果某个分片由于网络问题出错,自动重传次数
threads {number} [可选] [默认值:3] 上传并发数。允许同时最大上传进程数。

使用方式

 <Upload chunked chunkSize={5242880}  chunkRetry={2} threads={3}>
    <Button>
      <UploadOutlined /> Click to Upload
    </Button>
  </Upload>
@afc163
Copy link
Member

afc163 commented Jul 31, 2020

You can try customRequest.

@afc163 afc163 added the help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. label Jul 31, 2020
@ant-design-bot
Copy link
Contributor

Hello @zerox-v. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to proper branch (feature branch for the new feature, master for bugfix and other changes), fill the Pull Request Template here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. Appreciate it advance and we are looking forward to your contribution!

你好 @zerox-v, 我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到正确的分支(新特性发到 feature 分支,其他发到 master 分支),务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献!

giphy

@4-1-1
Copy link

4-1-1 commented Aug 3, 2020

这个上传写到customRequest就完事了吧, 或者关闭customRequest

  customRequest=() => {
        // 禁用自动上传
    }
<Dragger
                            fileList={fileList}
                            onChange={this.onUpload}
                            onRemove={this.onRemoveFile}
                            multiple
                            customRequest={this.customRequest}
                            iconRender={this.renderLinkIcon}
                        >
                            <p className="ant-upload-drag-icon">
                                <InboxOutlined />
                            </p>
                            <p className="ant-upload-text">单击或拖动文件到该区域上传</p>
                            <p className="ant-upload-hint">
                                支持单一或批量上传。
                            </p>
                        </Dragger>

然后从state里获取本地的上传数据, 自己分片上传。

@falkenhawk
Copy link

You can try customRequest.

has someone implemented it in the meantime and could share an example, please?

@tanyo520
Copy link

这块有没有分片上传的demo

@xylplm
Copy link

xylplm commented May 24, 2022

得,沉了的需求。然而这个现在很影响体验。
现在Upload上传组件,上传失败后,只能删除后,重新选择上传。体验很差,希望可以支持上传组件的重试按钮,点击后立即重新上传。
特别是针对批量上传,其中某几个失败后,对方看见原因,如果是网络问题,可以一键重试。

@ZHHHuaZhang
Copy link

upload这个组件还有许多改进的空间

@hzm2023
Copy link

hzm2023 commented Dec 31, 2022

分片上传怎么做?有没有demo?

@Wxh16144
Copy link
Member

分片上传怎么做?有没有demo?

可以看看 #41484 PR(demo 太长了, 未被 merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted The suggestion or request has been accepted, we need you to help us by sending a pull request. Inactive
Projects
None yet
Development

No branches or pull requests

10 participants