-1

My original zip file is 4KB. When i upload it via ftp on server, the size is smaller namely 3.032KB.it seems to me zip file is corrupted and can't be open. Why it happens? how can be fixed?

ftp code

public static void uploadFilesToServer(String filename){

    File file = new File(filename);
    FTPClient client = new FTPClient();
    FileInputStream fis = null;

    try {
        client.connect("ftpsrv2.koln.de");
        client.login("user", "pass");
        client.setFileType(FTP.BINARY_FILE_TYPE);

        fis = new FileInputStream(filename);
        if(client.storeFile(file.getName(), fis)){
            System.out.println("Upload success");
        }else{
            System.out.println("Upload faild");
        }
        client.logout();
        fis.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
itro
  • 7,006
  • 27
  • 78
  • 121
  • 3
    Isn't it 4 k due to the cluster size on your hard-drive? Have you really checked the exact byte size? – aioobe Mar 20 '12 at 15:14
  • Define "fixed"--have you verified the file is no longer valid? Or are you just assuming however you're looking at the file size is reporting its actual size in bytes? – Dave Newton Mar 20 '12 at 15:20
  • If i put bigger zip file result is the same. uploaded file is smaller and can't be open. seems to be corrupted. – itro Mar 20 '12 at 15:24

1 Answers1

3

Everything is fine, 4kb is the minimum block size of your disk. Have a look at this.

Community
  • 1
  • 1
yan.kun
  • 6,820
  • 2
  • 29
  • 38