0

I got a weird bug here. In order to upload file to my ftp server I imported ftp4j package in my android app. Problem is whenever the upload is complete the uploaded file size change, I checked the file content it does not match the original content as well. Also I don't think this is caused by internet problem accidentally, as I tested my code for three times and I got the same results, the original file size is 154266 in bytes and the remote size became 201673 bytes every time the upload completed.

Here is part of my code.

client = new FTPClient();
client.upload(file, new MyTransferListener(file));

public class MyTransferListener implements FTPDataTransferListener {
    private File file;
    private String filename;

    public MyTransferListener(File file) {
        this.file = file;
        filename = file.getName();
    }

    ...

    @Override
    public void completed() {
        try {
                file.delete();
            } catch (Exception e) {}
    }
    ...
}
4

1 回答 1

1

认为您正在以文本模式上传。尝试首先将您的客户端置于二进制传输模式。

于 2016-01-27T22:00:01.563 回答