public function validateFile(File $file)
    {
        if (!$this->acceptsExtension($file->getExtension())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with extension %s", $file->getExtension()));
        }

        if (!$this->acceptsMime($file->getMime())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with mime of %s", $file->getMime()));
        }

        if (!$this->acceptsMimeType($file->getMimeType())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with mime type of %s", $file->getMimeType()));
        }

        if (!$this->acceptsMimeEncoding($file->getMimeEncoding())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with mime encoding of %s", $file->getMimeEncoding()));
        }

        if ($this->getRequiredType()) {
            if ($this->getRequiredType() !== $file->getType()) {
                throw new Exception\InvalidFileException(sprintf("This definition only accept files of type %s", $this->getRequiredType()));
            }
        }

        if (!$this->getAllowDirectory() && $file->isDir()) {
            throw new Exception\InvalidFileException("This definition cannot accept a directory as input");
        }

        return true;
    }