public UploadableFile(AmazonS3 s3, File baseDir, File file, String bucket, String targetDir) {
        super(file.getAbsolutePath());

        this.s3 = s3;
        this.baseDir = baseDir;
        this.bucket = bucket;

        if (targetDir == null) {
            targetDir = "";
        } else if (! targetDir.endsWith("/")) {
            targetDir += "/";
        }
        this.targetDir = targetDir;
    }