Загрузка нескольких файлов AWS Storage (изображения и видео)

import S3 from "react-aws-s3";

  const config = {
    bucketName: "bucketname",
    dirName: localStorage.getItem("userId"), //store with userid for identification at backend
    region: "eu-west-2",
    accessKeyId: process.env.REACT_APP_AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.REACT_APP_AWS_SECRET_ACCESS_KEY,
  };
  
        const ReactS3Client = await new S3(config);

      for (let i = 0; i < file.length; i++) {
        const filename = Date.now() + file[i].name;
        const url = await ReactS3Client.uploadFile(file[i], filename)
          .then(async (data) => {
            return data.location;
          })
          .catch((err) => console.error(err));
        file[i] = url;
      }
Bloody Bear