问题
I'm using java FTPClient for FTPconnection. This library has storeFile
method for saving a file on FTP. I use it like this:
FTPClient ftpClient = new FTPClient();
//code for connection and login
...
ftpClient.storeFile("test.jpg", stream); //stream is an InputStream
Now, I need to set working directory on FTP. For example I want to save my .jpg
in the specific folder. Is ftpClient.storeFile("1/test.jpg", stream);
correct?
Or is there another solution?
回答1:
I think you should call FTPClient#changeWorkingDirectory()
(the docs) prior to storeFile()
.
来源:https://stackoverflow.com/questions/27922851/how-to-set-working-directory-on-ftpusing-ftpclient