title: Upload a file created using FileSystem API to S3 bucket using JavaScript
body: <p>When I am trying to upload a file (FILE_PATH) to S3 bucket it's getting uploaded but I am getting file path (FILE_PATH) as content in the file. Please can you tell where I am doing it wrong?</p>
  
  <p>I followed this link <a href="https://www.html5rocks.com/en/tutorials/file/filesystem/#toc-file" rel="nofollow noreferrer">https://www.html5rocks.com/en/tutorials/file/filesystem/#toc-file</a> to create a file and write into it.</p>
  
  <p>Everything seems to work except that I am getting file path (FILE_PATH) as content in the uploaded file</p>
  
  <p>Here is my code.</p>
  
  <pre><code>var FILE_PATH = 'filesystem:http://localhost:5000/temporary'
  
    function onInitFs(fs) {
      fs.root.getFile('log.json', {create: true}, function(fileEntry) {
  
        fileEntry.createWriter(function(fileWriter) {
  
          fileWriter.onwriteend = function(e) {
            console.log('Write completed.');
          };
  
          fileWriter.onerror = function(e) {
            console.log('Write failed: ' + e.toString());
          };
  
          var sukshi_dict = {
            "sfds": "sdfse"
          }
  
          var sukshi_dict = JSON.stringify(sukshi_dict);
          var blob = new Blob([sukshi_dict], {type: "application/json"});
          fileWriter.write(blob);
          addPhoto('hero', FILE_PATH)
        }, errorHandler);
        FILE_PATH = FILE_PATH + fileEntry.fullPath
        console.log(FILE_PATH)
      }, errorHandler);
  
    }
  
    window.requestFileSystem(window.TEMPORARY, 5*1024*1024 /*5MB*/, onInitFs, errorHandler);
  
  function addPhoto(albumName, file_path) {
      debugger
      var file = file_path;
      if (!file.length) {
        return alert('Please choose a file to upload first.');
      }
      var fileName = file.substring(file.lastIndexOf('/')+1);
      console.log(fileName)
      var albumPhotosKey = encodeURIComponent(albumName) + '/';
  
      var photoKey = albumPhotosKey + fileName;
      s3.upload({
        Key: photoKey,
        Body: file,
        ACL: 'public-read'
      }, function(err, data) {
        if (err) {
          return alert('There was an error uploading your photo: ', err.message);
        }
        alert('Successfully uploaded photo.');
      });
    }
  </code></pre>