Skip to content

Instantly share code, notes, and snippets.

@EcomGraduates
Forked from josemariagarcia95/upload-to-ftp.js
Created October 11, 2021 23:43
Show Gist options
  • Save EcomGraduates/96a76f045b8b70e7c45801019df7a210 to your computer and use it in GitHub Desktop.
Save EcomGraduates/96a76f045b8b70e7c45801019df7a210 to your computer and use it in GitHub Desktop.
Code snippet to upload files to FTP server using Node.js
const Ftp = require( 'ftp' );
const ftpClient = new Ftp();
ftpClient.on( 'ready', function() {
ftpClient.put( './prueba.jpg', '/www/img/prueba.jpg', function( err, list ) {
if ( err ) throw err;
ftpClient.end();
} );
} );
ftpClient.connect( {
'host': '*****************',
'user': '***************',
'password': '**************'
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment