How to create a Base64 Video String for AWS.S3

Hi guys,
I integrated the AWS.S3 service into my Ionic App but I have a problem with getting a video from my Gallery.
I used this code in order to retrieve a video: => {
  console.log("FILE IMAGE DATA: ", imageData);
}, (err) => {
  console("ERROR -> " + JSON.stringify(err));

imageData is a uri path of my video file, for example ‘/storage/…/myVideo.mp4’

In order to send the file to AWS.S3 I think that I need to convert it into Base64String.

How can I do it?

Could you please help me?


Find another way, base 64 increases the size around 30% or something along those lines. You don’t want to increase your upload time and data usage? Do you?

1 Like

Ok @user5555 , I’d like to improve my performance but I don’t understand how AWS.S3 works.
Have you an advice for me?



I don’t worked with Amazon s3 yet but I know that base 64 is a bad idea for videos, its already not the best idea for pictures - but it does for a great way/workaround to display pictures and transfer data in older browsers as far as I know. Maybe you can search after a tutorial on Google. Firebase might have a simpler solution, but I doesn’t tried that either, yet.

1 Like

My customer has chosed AWS.S3 as a his provider. This is an examplewith angular and HTML.

Uunfortunately I cannot find any examples that use the resources retrieved from the camera

I had problems with the camera plugin, too. I doesn’t want to do what its supposed to sometimes.

What part of the AWS JavaScript SDK documentation gave you this impression?

It is a personal idea. When I get item from camera I have a file uri, I don’t know how send the file to S3.

The following code works from browser. I create programmatically a new text file. When I run it from simulator, I receive error.

let mediaUrl = this.uploader.upload(new File(["foo"], "foo.txt", {
      type: "text/plain",
    }), function (err, data) {

      if (err) {
        console.log('There was an error uploading your file: ', err);
        return false;
      console.log('Successfully uploaded file.', data);


I need to select file from camera and send to S3 Service.



I think the video will firstly have another file type. Then its importent that your aws urls are whitelisted in your config.xml