Giter Site home page Giter Site logo

puchenhui / file-upload-react Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shenmaxg/file-upload-react

1.0 0.0 0.0 6.64 MB

【前端】大文件上传解决方案,切片,断点续传,秒传,失败自动重传

License: MIT License

JavaScript 96.65% Less 3.35%

file-upload-react's Introduction

file-upload-react

【前端】大文件上传解决方案,切片,断点续传,秒传,失败自动重试。

特性

  1. 大文件切片上传。
  2. 重复文件秒传。
  3. 断点续传。
  4. 控制请求并发数。
  5. 显示每个切片的上传进度。
  6. 切片上传失败自动重试。

启动

npm install --> npm start

该项目还需要 file-upload-server 项目的配合。请启动 server 后再进行后续操作。

切片上传

我们创建一个 500M 的文件,切片大小为 10M。由于 chrome 浏览器并发数量有限,我们限制最大并发为 6,进行切片文件的上传。演示如下。

preview

秒传

还是之前的文件,由于已经上传成功,第二次上传的时候触发秒传。

second

断点续传

上传停止后,可以从断点处重新开始上传。

point

失败自动重试

后台设置首次上传失效,可以看到,切片上传失败后自动重试。

retry

注意事项

由于是前后端分离的应用,是存在跨域问题的,前端的端口修改后,记得将后端的 cors 设置改掉,否则后报跨域错误。

相关阅读

如何做大文件上传

file-upload-react's People

Contributors

shenmaxg avatar

Stargazers

Tom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.