title: Error 502 "Command Not Supported" when uploading a file using FTP NodeJS
body: <p>I'm trying to create FTP server using ftp-srv library and then to upload a file to it using FTP client library jsftp.</p>
  
  <p>All the functions(Rename,ls,etc..) are working except the upload function which fails with the error 502 command not supported.</p>
  
  <p>The FTP server code:</p>
  
  <pre><code>const ftpServer = require('ftp-srv'); 
  
  const startFtpServer = async (host, port, user, pass) =&gt; {  
  
  
    const server = new ftpServer(`ftp://${host}:${port}`, { 
      pasv_range: '8400-8500', // change this to an open port range for your app 
      greeting:"Hello to my custom server",
    }); 
  
    server.on('login', ({ connection, username, password }, resolve, reject) =&gt; { 
      if (1) { 
        // If connected, add a handler to confirm file uploads 
        connection.on('STOR', (error, fileName) =&gt; { 
          if (error) { 
            console.error(`FTP server error: could not receive file ${fileName} for upload ${error}`); 
          } 
          console.info(`FTP server: upload successfully received - ${fileName}`); 
        }); 
        resolve({ root: 'C:/Users/kjaber/Desktop/serv' }); 
      } else { 
        reject(new Error('Unable to authenticate with FTP server: bad username or password')); 
      } 
    }); 
  
    server.on('client-error', ({ context, error }) =&gt; { 
      console.error(`FTP server error: error interfacing with client ${context} ${error} on ftp://${host}:${port} ${JSON.stringify(error)}`); 
    }); 
  
    const closeFtpServer = async () =&gt; { 
      await server.close(); 
    }; 
  
    // The types are incorrect here - listen returns a promise 
  
    await server.listen(); 
  
  
    return { 
      shutdownFunc: async () =&gt; { 
        // server.close() returns a promise - another incorrect type 
        await closeFtpServer(); 
      }, 
    }; 
  }; 
  
  startFtpServer("127.0.0.1","60000","anonymous","chrome@example.com");
  </code></pre>
  
  <p>This open an FTP server to port 21.</p>
  
  <p>The FTP client:</p>
  
  <pre><code>var fs = require("fs");
  
  var ftp = new jsftp({
  host: "127.0.0.1",
  port: 21, // defaults to 21
  user: "a", // defaults to "anonymous"
  pass: "b" // defaults to "@anonymous"
  });
  
  ftp.auth("aaaa", "bbbb", function(hadErr) {
  if (!hadErr)
  console.log("auth succesfull")
  });
  
  
  ftp.raw("quit", (err, data) =&gt; {
    if (err) {
      return console.error(err);
    }
  
    console.log("Bye!");
  });
  
  ftp.put('C:/Users/kjaber/Desktop/Console/bbb.txt', "/", err =&gt; {
    console.log(err)
    if (!err) {
      console.log("File transferred successfully!");
    }
  });
  </code></pre>
  
  <p>After running the client i get the error "Error: 502 Command not supported" .
  I tried to use FileZella as FTP client and the upload succeeded but using the above client code it doesn't work.
  Any idea why ?</p>