Access Denied on upload with 'Rebex tiny SFTP Server' and ssh2 node module

0 votes
asked May 18 by jbRandria (130 points)

Please help I have always the Access denied error when i try to upload on server :

 
conn.on("ready", () => {
conn.sftp((err,sftp) => {
if (err) throw err;
var providedFileName = util.format("%s", localFilePath);
sftp.fastPut(providedFileName, '/',(err) => {
console.log('Erreur', err);
});
});
});
conn.connect(sftpConfig);

1 Answer

+1 vote
answered May 18 by Lukas Pokorny (94,670 points)

You need to specify a path to a file name when calling ssh2's fastPut function (details). Try calling sftp.fastPut(providedFileName, '/' + basename(providedFileName), ...) instead.

commented May 18 by jbRandria (130 points)
Cooooooool
thank you , it works perfectly now
...