JavaScript How do I upload a zip file to Amazon S3 using Javascript (Angular framework)? upload file amazon s3 javascript,upload file amazon s3 java,

Using the following code:

params = {
    Bucket: 'bucket.com',
    Key: zipPath
    },
s3 = new AWS.S3();
params.Body = zipFile;
s3.putObject(params, function(err, data) {
    if (err) {
        logger.info('Upload error: ' + err);
    } else {
        logger.info('Uploaded: ' + String(data));
    }
});

When I change the body contents to a string (i.e 'Hello'), it will upload perfectly fine. However, when I try to attach a zip file, it is not working. Any ideas? I am really new to uploading files and can't seem to find any answers online.

Error that I get: Upload error: Error: Cannot determine length of [object Object]

EDIT: the zip contains images.

Answer:1

I am starting to use Ractive and I would like to understand better how to make reusable components. It is quite easy to write a generic widget that can be used in different situations. My problem is ...

I am starting to use Ractive and I would like to understand better how to make reusable components. It is quite easy to write a generic widget that can be used in different situations. My problem is ...

I'm trying to write a lightbox that shows an image inside a container when a div is being clicked. Said div has the actual image to be displayed as a background image, working as a thumbnail. These ...

I'm trying to write a lightbox that shows an image inside a container when a div is being clicked. Said div has the actual image to be displayed as a background image, working as a thumbnail. These ...

  1. getting client side value in code behind

can anyone tell me why this is not working? ui = (function() { collabElement = document.getElementById( 'approveCollab' ); if(collabElement) collabElement.onclick = function(){editor....

can anyone tell me why this is not working? ui = (function() { collabElement = document.getElementById( 'approveCollab' ); if(collabElement) collabElement.onclick = function(){editor....

I am trying to add markers via Json once a visitor moves the map. For some reason the moveend is not caught and / or the function onClickCallback is not triggered. Where am I going wrong here. ...

I am trying to add markers via Json once a visitor moves the map. For some reason the moveend is not caught and / or the function onClickCallback is not triggered. Where am I going wrong here. ...