title: Node.js ftp put method is writing the name of the file to be uploaded to the ftp server, not the actual file
body: <p>I am trying to write an app that uploads files to an ftp server in node.js using the npm module ftp.  I have a file, foo.txt, whose content is a single line: "This is a test file to upload via ftp."  My code is:</p>
  
  <pre><code>var Client = require("ftp");
  var fs = require("fs");
  var connection = require("./connections.js");
  
  var c = new Client();
  
  const ftpFolder = "./files/";
  
  var fileList = [];
  
  fs.readdir(ftpFolder, (err, files) =&gt; {
      if(err) {
          console.log(err);
      } else {
          files.forEach(file =&gt; {
              console.log(file);
              fileList.push(file);
          });
      }
      console.log(fileList);
  });
  
  c.on("ready", function(){
      fileList.forEach(file =&gt; {
          c.put(file, "/backups/" + file, function(err){
              if(err){
                  console.log(err);
              } else {
                  console.log(file + " was uploaded successfully!");
              }
              c.end();
          });
      });
  });
  
  // Connect to ftp site
  c.connect(connection.server_ftp);
  </code></pre>
  
  <p>I see the file foo.txt on the ftp server, but when I open it the contents are: "foo.txt".  It appears to have written the name of the file to the file rather than uploading it.  Any guidance would be appreciated!</p>