Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Is it possible to get the ip address of the client of a file that was just uploaded? #347

Open
zrougeau opened this issue Dec 20, 2022 · 1 comment

Comments

@zrougeau
Copy link

zrougeau commented Dec 20, 2022

Is it possible to get the ip address of the client of a file that was just uploaded to the server?

Something like this:

connection.on('STOR', (error, fileName,client_ipaddress) => { 

  console.log('the client's ip address is: + client_ipaddress);

}); 

Or get the connection id of the client that just uploaded a file to the server?

Something like this:

connection.on('STOR', (error, fileName,client_id) => { 

  console.log('the client's ip address is: + client_id);

}); 
@seyyednaquib
Copy link

Yes. you need the connection object

ftpServer.on("login", ({ username, password, connection }, resolve, reject) => {
if (username === CONFIG.user && password === CONFIG.password) {
connection.on('STOR', (error, fileName) => {
console.log('the client's ip address is: + connection.log.fields.ip);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants