I have this code which uploads to my ftp server fine however i am unable to return a value of how far the file has uploaded, any help would be appreciated thanks.
code:
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.SocketException;
public class FileUpload {
public FileUpload()
{
}
public static void main(String[] args) {
FTPClient ftp = new FTPClient();
try {
ftp.connect("localhost");
ftp.login("user","pass");
int reply = ftp.getReplyCode();
if(FTPReply.isPositiveCompletion(reply)){
System.out.println("Connected Success");
}else {
System.out.println("Connection Failed");
ftp.disconnect();
}
FileInputStream in = null;
try {
in = new FileInputStream("/home/matt/Desktop/testfile.txt");
ftp.storeFile("/home/matt/testfile.txt",in);
ftp.disconnect();
}catch(IOException e){
System.out.println(e);
}
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}