1

I'm getting a 550 Filename invalid error when I try to copy a file to an ftp server. It is getting connected and logged in.

ftp.connect(server);
ftp.login(user, password);

String filename = "testing.txt";
fis = new FileInputStream(filename);
File file = new File(filename);
FileInputStream fis = new FileInputStream(file);
String cwd =client.printWorkingDirectory();

boolean check = ftp.storeFile("C:\\test\\"+filename, fis);
if(!check)System.out.println(ftp.getReplyString());

Can anyone tell me where I'm going wrong?

Thanks

I think its just a case of file permissions.

rv1822
  • 169
  • 3
  • 10
  • Possible duplicate of [vsftpd - Cannot upload files to the server. Error 553](http://stackoverflow.com/questions/18749681/vsftpd-cannot-upload-files-to-the-server-error-553) – tripleee Mar 23 '17 at 06:13

1 Answers1

2

You're sending the fully-qualified name - I suspect you're only meant to send relative filenames to the FTP server.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Could you give an example? If i do `ftp.storeFile(filename, fis);` it is getting stored in a default directory, but I don't want that. `ftp.changeWorkingDirectory("C:/test");` is not working either. – rv1822 Feb 14 '12 at 08:58