title: Uploading files to S3 using node.js
body: <p>I'm creating a portal where users can select and upload single files from their PC to S3 on AWS.</p>
  
  <p>Below is my server.js code:</p>
  
  <p>app.post('/submit_doc', function(req, res){</p>
  
  <pre><code>var FileName = req.body.fileName,
  Filedescription = req.body.filediscrip,
  InputFileName = req.body.inputfile;
  AWS.config.region = 'eu-west-1';
  var fileStream = fs.createReadStream(FileName);
  fileStream.on('error', function (err) {
      if (err){
          console.log("Error reading file: ", err);
          res.send(500);
      }
      else{
          fileStream.on('open', function () {
              var s3 = new AWS.S3();
              s3.putObject({
                  Bucket: 'exampleassetcare.com',
                  Key: 'reports/'+FileName,
                  Body: fileStream
               }, function (err) {
               if (err) { 
                   console.log("Error uploading data: ", err);
                   res.send(500);
               }
           });
       });
  </code></pre>
  
  <p>I get the error: No such file or directory.</p>
  
  <p>Can someone please help?</p>