title: NodeJS/ReactJS File Upload to Digital Ocean Spaces
body: <p>A lot of the different answers on SO seem to have different ideas about how to go about this...I've been trying to piece them together and get this working, but no luck. </p>
  
  <p>Basically, my <code>console.log("uploading....")</code> and <code>console.log("uploaded....")</code> show up, but nothing is actually getting uploaded. No errors display, either.</p>
  
  <p><code>server.js</code>:</p>
  
  <pre><code>const aws = require("aws-sdk");
  const multer = require("multer");
  const multerS3 = require("multer-s3");
  
  //aws setup
  const s3 = new aws.S3();
  aws.config.update({
    secretAccessKey: "MY_SECRET",
    accessKeyId: "MY_KEY",
    region: "us-east-1"
  });
  
  const upload = multer({
    storage: multerS3({
      s3: s3,
      bucket: "filehub",
      key: function(req, file, cb) {
        cb(null, file.originalname);
      }
    })
  }).array("upload", 1);
  
  app.post("/files/upload_aws", (req, res, next) =&gt; {
    upload(req, res, function(err) {
      console.log("uploading....");
      if (err) {
        console.log(err);
      }
      console.log("uploaded....");
    });
  });
  </code></pre>
  
  <p>And on the front end, in case it's help to anybody, though this part seems to be working just fine:</p>
  
  <pre><code>  handleAWSFile = e =&gt; {
      e.preventDefault();
  
      console.log("clicked");
  
      axios
        .post("files/upload_aws")
        .then(res =&gt; {
          this.props.handleSnackBar("File added to AWS");
        })
        .catch(res =&gt; {
          this.props.handleSnackBar("File NOT added to AWS!!");
        });
    };
  </code></pre>