I'm trying to upload an image from android to ftp server, but when i try to open the image that i uploaded i see the following message instead of the image "the image cannot be displayed because it contains errors"
and this is the code that i use
    public void uploadImage(String path){
     String server = "www.domainname.com";
        int port = 21;
        String user = "ftp-username";
        String pass = "ftp-password";
    FTPClient ftpClient = new FTPClient();
    try {
        ftpClient.connect(server, port);
        ftpClient.login(user, pass);
        ftpClient.enterLocalPassiveMode();
        ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        // APPROACH #1: uploads first file using an InputStream
        File firstLocalFile = new File(path);
        long fileSize = firstLocalFile.length();
        Log.i("File Size",fileSize+"");
        String firstRemoteFile = "testfile1.jpg";
        InputStream inputStream = new FileInputStream(firstLocalFile);
        Log.i("uploading", "Start uploading first file");
        boolean done = ftpClient.storeFile(firstRemoteFile, inputStream);
        inputStream.close();
        if (done) {
            Log.i("uploaded", "finished uploading first file");
        }
        // APPROACH #2: uploads second file using an OutputStream
        File secondLocalFile = new File(path);
        String secondRemoteFile = "testfile2.jpg";
        inputStream = new FileInputStream(secondLocalFile);
        Log.i("uploading", "Start uploading second file");
        OutputStream outputStream = ftpClient.storeFileStream(secondRemoteFile);
        byte[] bytesIn = new byte[4096];
        int read = 0;
        while ((read = inputStream.read(bytesIn)) != -1) {
            outputStream.write(bytesIn, 0, read);
        }
        inputStream.close();
        outputStream.close();
        boolean completed = ftpClient.completePendingCommand();
        if (completed) {
            Log.i("uploaded", "finished uploading second file");
        }
    } catch (IOException ex) {
        Log.i("Error", "Error: " + ex.getMessage());
        ex.printStackTrace();
    } finally {
        try {
            if (ftpClient.isConnected()) {
                ftpClient.logout();
                ftpClient.disconnect();
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}
where is the error!!?
Thanks in advance..