public function setMagicFile($file)
    {
        if (empty($file)) {
            $this->_magicfile = null;
        } else if (!(class_exists('finfo', false))) {
            $this->_magicfile = null;
            // require_once 'Zend/Validate/Exception.php';
            throw new Zend_Validate_Exception('Magicfile can not be set. There is no finfo extension installed');
        } else if (!is_file($file) || !is_readable($file)) {
            // require_once 'Zend/Validate/Exception.php';
            throw new Zend_Validate_Exception('The given magicfile can not be read');
        } else {
            $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
            $this->_finfo = @finfo_open($const, $file);
            if (empty($this->_finfo)) {
                $this->_finfo = null;
                // require_once 'Zend/Validate/Exception.php';
                throw new Zend_Validate_Exception('The given magicfile is not accepted by finfo');
            } else {
                $this->_magicfile = $file;
            }
        }

        return $this;
    }