The following code is meant to take a file (any file would be nice, but right now I'm just using images anyway), and upload it to my server (which works, blah blah blah). The only problem is that the picture is quite skewed after transfer. The main suggestion is to use FTPClient's setFileTranferMode to FTPClient.BINARY_FILE_TYPE, which... has no effect at this point...
Here's the code for the method:
public void sendFile(File sendMe) throws IOException{
f.connect(ip);
f.login(username, password);
String recipient=null;
while(!f.changeWorkingDirectory(path+recipient)){
recipient=JOptionPane.showInputDialog("What is the name of the computer you are sending this to?");
}
f.changeWorkingDirectory(path+recipient);
f.setFileTransferMode(FTPClient.BINARY_FILE_TYPE);
f.storeFile(sendMe.getName(), new BufferedInputStream(new FileInputStream(sendMe)));
System.out.println("Stored!");
f.disconnect();
System.out.println("Uploaded");
}
As always, any help would be much appreciated! Thanks!