jsftp icon indicating copy to clipboard operation
jsftp copied to clipboard

put doesn't work

Open Luisadz24 opened this issue 8 years ago • 1 comments

I have a problem when I tried to put a file in the fTP server, my program show me an error that is:

Error: Local file doesn't exist.
    at C:\Users\000\Documents\Trabajo\Mabe\Programas javascript\clienteftp\node_modules\jsftp\lib\jsftp.js:572:25
    at FSReqWrap.oncomplete (fs.js:112:15)

and my file exists, my code is the next (sorry for my bad english)

var JSFtp = require("jsftp");

var buffer='C:/Users/000/Documentos/frente0002.jpg';
var remote='/acm/img.jpg';
 
var Ftp = new JSFtp({
  host: 'ip',
  port: 21, // defaults to 21
  user: 'cliente',
  pass:'',
  debugMode: true  
});

Ftp.raw("cwd", "/",function(err, data) {
    if (err) return console.error(err);
     console.log("quede en cwd");
    console.log(data.text); // Show the FTP response text to the user
    console.log(data.code); // Show the FTP response code to the user

    Ftp.raw("pwd", "/new", function(err, data) {
    if (err) return console.error(err);
    console.log("quede en pwd");
    console.log(data.text); // Show the FTP response text to the user
    console.log(data.code); // Show the FTP response code to the user

             Ftp.put(buffer, remote, function(hadError) {
              if(hadError)return console.log(hadError);
                console.log("Archivo en servidor");

                 Ftp.raw("quit", function(err, data) {
                      if (err) return console.error(err);

                      console.log(data.text); // Show the FTP response text to the user
                      console.log(data.code); // Show the FTP response code to the user

                    });                
                   
        });

  });    

});

Luisadz24 avatar Sep 16 '17 00:09 Luisadz24

What's the output of this code?

sergi avatar Jan 25 '18 13:01 sergi