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

大文件秒传需求建议 #3

Closed
seamanm opened this issue Nov 15, 2017 · 2 comments
Closed

大文件秒传需求建议 #3

seamanm opened this issue Nov 15, 2017 · 2 comments

Comments

@seamanm
Copy link

seamanm commented Nov 15, 2017

可否增加一个事件:每个文件在上传之前可以触发,根据服务端内容判断文件是否需要上传,因为有的文件服务端已经存在,不需要再上传。这个时间不是针对chunk的,是针对文件的,场景如下:比如,用户选择了5个文件A、B、C、D、E,每个文件3G,实际上服务端已经有C和D两个文件。文件开始上传,A、B,传到C的时候,事件触发,服务端返回数据告诉文件已经存在,不需要传了,然后调用方法,在用户界面显示C已经传完。让后继续传D,触发事件,不需要传,然后再继续传E,服务端没有这个文件,需要传。因为文件秒传不仅仅是chunk需要,针对整个文件也需要。本身我是做后端的,也许你们已经有这个机制,只是我没找到,有的话麻烦告诉下。另外说一下,这个上传插件确实很给力,我们这里用来传大文件,动不动就是几个G。

@dolymood
Copy link
Member

这个需求本质上和 #1 是类似的,也就是不是对每个块来做判断;可以考虑使用 checkChunkUploadedByResponse 这个选项来做,如果再加上 testChunks 的话可能每个文件的第一个块的内容也不需要上传了,只是发送一个 GET 请求即可,在这个请求返回数据中你可以直接自由约定,然后去检验这个文件的每个块是否还需要继续上传,如果返回了 true 则代表该文件块已上传,无需上传这块文件了。

这样就能实现对于每个文件而言,首先会发一个请求得到结果,根据这个结果来决定文件哪些块是已经上传的,如果说判断每个块都是已经上传成功的,那么对于已经上传成功的文件,只需要发送一次请求即可。

@seamanm
Copy link
Author

seamanm commented Nov 16, 2017

好的,我先按照你告诉的试下看看。

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