question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Aws-s3-multipart doesn't work

See original GitHub issue

When I try to upload a file using Aws-s3-multipart, nothing happens— no upload progress bar, error message, or activity on my aws s3 account. I’ve installed through the CDN package and included my javascript code through a script tag. Here is my code:

<!DOCTYPE html>
<html>
  <head>
    <title>VideoUpload</title>
    <%= csrf_meta_tags %>

    <%= stylesheet_link_tag    'application', media: 'all' %>
    <%= javascript_include_tag 'application' %>
  </head>

  <body>
    <%= yield %>
    <script src="https://unpkg.com/babel-polyfill@6.26.0/dist/polyfill.min.js"></script>
    <script src="https://unpkg.com/tus-js-client@1.4.5/dist/tus.js"></script>
    <script src="https://transloadit.edgly.net/releases/uppy/v0.27.5/dist/uppy.min.js"></script>
    <link href="https://transloadit.edgly.net/releases/uppy/v0.27.5/dist/uppy.min.css" rel="stylesheet" />
 </body>
 <script>
  function fileUpload(fileInput) {
     fileInput.style.display = 'none'; // uppy will add its own file input
     const imagePreview = document.querySelector(".upload-preview");

     var uppy = window.Uppy.Core({
         id: fileInput.id,
       })
       .use(window.Uppy.FileInput, {
         target: fileInput.parentNode,
       })
       .use(window.Uppy.Informer, {
         target: fileInput.parentNode,
       })
       .use(window.Uppy.ProgressBar, {
         target: imagePreview.parentNode,
       });

     uppy.use(window.Uppy.AwsS3Multipart, {
       serverUrl: '',
     });

     uppy.on('upload-success', function (file, data, uploadURL) {
       console.log("SUCCESS");
       // show image preview
       imagePreview.src = URL.createObjectURL(file.data)
       // construct uploaded file data in the format that Shrine expects
       var uploadedFileData = JSON.stringify({
         id: uploadURL.match(/\/cache\/([^\?]+)/)[1], // extract key without prefix
         storage: 'cache',
         metadata: {
           size:      file.size,
           filename:  file.name,
           mime_type: file.type,
         }
     });

      // set hidden field value to the uploaded file data so that it's submitted with the form as the attachment
      var hiddenInput = fileInput.parentNode.querySelector('.upload-hidden')
      hiddenInput.value = uploadedFileData;
    })

     return uppy;
   }

   document.querySelectorAll("#file-input").forEach( fileInput => {
     fileUpload(fileInput)
   });

   //Move the submit button to the end of the form
   const submitButton = document.getElementById('submit');
   const uploadForm   = document.querySelector('.upload-form');
   uploadForm.append(submitButton);
 </script>
</html>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jankocommented, Nov 9, 2018

@samdealy Great 😃

@goto-bus-stop @arturi This issue can be closed.

1reaction
jankocommented, Oct 17, 2018

@samdealy The autoproceed option needs to be in camel case – autoProceed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon s3 multipart upload - not uploading
Everything works fine. I have no clue why the multi part upload is failing without any exception. I know it is used for...
Read more >
Use the AWS CLI for a multipart upload to Amazon S3
I want to copy a large file to an Amazon Simple Storage Service (Amazon S3) bucket as multiple parts or by using multipart...
Read more >
Working with multipart uploads
With the Hitachi API for Amazon S3, you can perform operations to create an individual object by uploading the object data in multiple...
Read more >
Multipart uploads with S3 pre-signed URLs
For that to work with pre-signed URLs, we should add one more stage: ... At this stage, we request from AWS S3 to...
Read more >
How do I upload a large file to S3 using AWS CLI ... - YouTube
How do I upload a large file to S3 using AWS CLI when the S3 console doesn't work ?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found