I have few excel files locally on my machine. I want to upload this excel file to ftp. I m using apache commons FTPClinet. But when it uploads the file, it is corrupted and size of the is zero. Here is the sample program
Can anyone point me where am i doing wrong?
public class App {
private static final String server = "localhost";
private static final String username = "test";
private static final String password = "test";
private static final String directory = "/home/files";
public static void main(String[] args) throws SocketException, IOException {
FTPClient f = new FTPClient();
f.connect(server);
f.login(username, password);
f.setFileType(FTPClient.BINARY_FILE_TYPE);
InputStream is = null;
is = new FileInputStream("c:\\tmp\\output.xls");
Boolean isStored = f.storeFile("status.xls", is);
is.close();
}
}