javascript - How to resume and upload file upload using tus-client - Stack Overflow

i want to pause and resume file upload as shown in this example .htmli'm using thisPlugini searc

i want to pause and resume file upload as shown in this example .html

i'm using this Plugin

i searched for every where but did not find any solution

Question: i want to pause and resume fileupload for multiple file

here is my full code:

Please help me thanks in advance!!

i want to pause and resume file upload as shown in this example https://tus.io/demo.html

i'm using this https://github./tus/tus-js-client Plugin

i searched for every where but did not find any solution

Question: i want to pause and resume fileupload for multiple file

here is my full code: https://codepen.io/eabangalore/pen/dwXEMM?editors=1010

Please help me thanks in advance!!

Share Improve this question edited Dec 18, 2018 at 4:40 EaBengaluru asked Dec 17, 2018 at 16:55 EaBengaluruEaBengaluru 892 gold badges30 silver badges73 bronze badges 1
  • the only thing i don't know how to 1. stop upload 2. resume upload with multiple Files – EaBengaluru Commented Dec 21, 2018 at 12:30
Add a ment  | 

1 Answer 1

Reset to default 5 +25

Uppy

You can use Uppy File Uploader for resumable uploads. It wraps tus-js-client.js and provide a simplified interface.

You can find its documentation here and live example here

After importing Uppy JS and CSS files on your web page you need to do some scripting something similar to following:

<script type="text/javascript">
  var uppy = new Uppy.Core({ debug: true, autoProceed: false });
  uppy.use(Uppy.Dashboard, {
    trigger: '.UppyModalOpenerBtn',
    inline: true,
    target: '.DashboardContainer'
});
  uppy.use(Uppy.Tus10, { endpoint: 'http://localhost:1080/files/' });
  uppy.run();
</script>

Some HTML:

<div class="DashboardContainer"></div>

Hope this would help. If not, feel free to further discuss the issue.

TUS protocol (Edit)

As discussed in ments, you want to upload multiple files usingtus-client-js instead of Uppy. For that you can have a look at this post to handle multiple uploads scenario: https://github./tus/tus-js-client/issues/115

The post is about initiating another file upload after the first one is pleted successfully.

EDIT

As per the documentation of tus-js-client library, you need to call abort to pause and start method of your file upload object to pause/resume the upload:

  1. Optionally pause the upload if the user/application wishes to do so using Upload#abort. This will cause any currently running transfers to be immediately stopped.

  2. Optionally resume the previously paused upload by called Upload#start again. This will resume the upload at the point at which it had stopped before. You can also use this approach to continue the upload after an error has occurred.

To learn more about what is going on under the hood, please visit this link.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745381580a4625252.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信