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

【Q742】大文件上传,如何获取到读取进度? #788

Open
NineSenz opened this issue Jul 13, 2022 · 1 comment
Open

【Q742】大文件上传,如何获取到读取进度? #788

NineSenz opened this issue Jul 13, 2022 · 1 comment

Comments

@NineSenz
Copy link

    <input type="file" id="input" onchange="handleFiles(this.files)" />

当用户选择大文件上传时,浏览区需要花很长时间读取文件,读取完成后才会触发onchange事件

问:

  1. 如何确定用户是选择了文件上传?还是取消了选择文件?
  2. 如果用户选择了文件,如何获取到读取进度?
@wolichuang
Copy link

  1. 选择完文件建立连接后,生成 hash 值给后端,每次后端先判断下是否有 hash 值传过来。
  2. 文件超过一定大小的时候,需要前端进行固定大小的,切片上传
  3. 后端根据切片来接收数据,返回上传进度

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

No branches or pull requests

2 participants