I know that there are multiple formats for ftp uploads.(Binary ascii etc…) I am writing a simple app to transfer files between my computer and a raspberry pi and I would like to know if there is a simple way to ensure that the upload is of the proper type. Additionally, I have been trying hard to get an upload of a .jar file to succeed with no luck. I believe that this is the same problem as already mentioned. Here is the code
private void uploadActionPerformed(java.awt.event.ActionEvent evt) {
FileInputStream in = null;
int returnVal = filechooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = filechooser.getSelectedFile();
try{
FTPClient f = new FTPClient();
f.connect("********");
f.login("*******", "********");
in = new FileInputStream(file.getAbsolutePath());
f.storeFile("public_html/GEdropbox/" + file.getName(),in);
in.close();
f.disconnect();
}catch(IOException e){
System.out.println("not working");
}
} else {
System.out.println("File access cancelled by user.");
}
}