else if (!toFile.exists() && !toFile.getAbsoluteFile().getParentFile().canWrite()) {
else if (!parent.exists() && !parent.mkdirs()) { throw new IOException("Parent directory of specified file does not exist and cannot " + " be created. File location supplied: " + toFile.getAbsolutePath()); } else if (!toFile.exists() && !parent.canWrite()) {
    public void save(File toFile) throws IOException {        // Since File.renameTo doesn't tell you anything about why it failed, we test        // for some common reasons for failure ahead of time and give a bit more info        if (!this.file.exists()) {            throw new IOException                ("Some time between uploading and saving we lost the file "                    + this.file.getAbsolutePath() + " - where did it go?.");        }        if (!this.file.canWrite()) {            throw new IOException                ("Some time between uploading and saving we lost the ability to write to the file "                    + this.file.getAbsolutePath() + " - writability is required to move the file.");        }        if (toFile.exists() && !toFile.canWrite()) {            throw new IOException("Cannot overwrite existing file at "+ toFile.getAbsolutePath());        }        else if (!toFile.exists() && !toFile.getAbsoluteFile().getParentFile().canWrite()) {            throw new IOException("Cannot create new file at location: " + toFile.getAbsolutePath());        }        this.saved = this.file.renameTo(toFile);        if (this.saved == false) {            throw new IOException("Tried to save file [" + this.file.getAbsolutePath() + "] to file ["            + toFile.getAbsolutePath() + "but got a false from File.renameTo(File).");        }    }