How to uplaod a file to FTP that contains a Key
Hi all,
Ive got this problem which is killing me.
I generated a file public.dat and put a key in it...
The code is as
[
ObjectOutputStream f = new ObjectOutputStream(new FileOutputStream("public.dat"));
System.out.println("\nStart generating RSA key");
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(1024);
KeyPair keypair = keyGen.generateKeyPair();
f.writeObject(keypair.getPublic());
f.close();
]
Now i want to upload this file to ftp....
Please help me out on this........
Its not working at alll
[631 byte] By [
nikku3881a] at [2007-11-27 6:08:44]

# 2
hi guys.
the solution simply use the following ( get ) you can use set ):
public static void sendFile() throws
Exception {
TelnetOutputStream telnetOutput = null;
FtpClient ftpClient = new FtpClient("localhost", 21);
File file = new File("D:\\dir1\\sqldeveloper-2364.zip");
byte[] data = application.getDataFromFile(file);
ftpClient.login("teamleader", "dev");
ftpClient.binary();
try {
TelnetInputStream input = ftpClient.get("sql.zip");
System.out.println("file name : " + file.getName());
telnetOutput = ftpClient.put(file.getName());
telnetOutput.write(data);
telnetOutput.flush();
telnetOutput.close();
} catch (IOException e) {
e.printStackTrace();
}
}
darima at 2007-7-12 17:11:33 >
