embeddedmz / ftpclient-cpp

C++ client for making FTP requests
MIT License
205 stars 65 forks source link

FTP upload failed #5

Closed PaulHe007 closed 4 years ago

PaulHe007 commented 4 years ago

FTPClient.InitSession("ftp://172.21.32.99", 21, "admin", "admin"); FTPClient.UploadFile("1.txt", "2.txt"); When I run the program, Error message: [FTPClient][Error] Unable to upload file 1.txt (Error = 3 | URL using bad/illegal format or missing URL). I find something wrong in function ParseURL: strURL is "ftp://172.21.32.99/2.txt", after executing the next statement: ReplaceString(strURL, "/", "//"); strURL turn into "ftp:////172.21.32.99//2.txt", it's bad format

embeddedmz commented 4 years ago

Try adding a '/' to the remote file ("2.txt")URL you want to upload : FTPClient.UploadFile("/home/user/1.txt", "/2.txt");

In fact, remote files must be specified with a full path starting from the root directory '/'.

Regards.