static function file( $key, $default = null, $validator = null) {
        if ( ! isset($_FILES[$key])
            || $_FILES[$key]['error'] != UPLOAD_ERR_OK)
            return self::processError($default);

        $file = new InputFile($_FILES[$key]['tmp_name']);
        $file->setContentType($_FILES[$key]['type']);
        $file->setOriginalName($_FILES[$key]['name']);

        if ($validator instanceof Validator) {
            if ( $validator->execute( $file ) ) {
                return $file;
            } else {
                return self::processError($default);
            }

        } else if (is_callable($validator)) {
            try {
                if ($validator($file) ) {
                    return $file;
                } else {
                    return self::processError($default);
                }
            } catch (Exception $e) {
                throw FrameworkException::internalError("Validator error");
            }
        }

        return $file;
    }
static function file( $key, $default = null, $validator = null) {
        if ( ! isset($_FILES[$key])
            || $_FILES[$key]['error'] != UPLOAD_ERR_OK)
            return self::processError($default);

        $file = new InputFile($_FILES[$key]['tmp_name']);
        $file->setContentType($_FILES[$key]['type']);
        $file->setOriginalName($_FILES[$key]['name']);

        if ($validator instanceof Validator) {
            if ( $validator->execute( $file ) ) {
                return $file;
            } else {
                return self::processError($default);
            }

        } else if (is_callable($validator)) {
            try {
                if ($validator($file) ) {
                    return $file;
                } else {
                    return self::processError($default);
                }
            } catch (Exception $e) {
                throw FrameworkException::internalError("Validator error");
            }
        }

        return $file;
    }
static function file ( $ key , $ default = null , $ validator = null ) { if ( ! isset ( $ _FILES [ $ key ] ) || $ _FILES [ $ key ] [ 'error' ] != UPLOAD_ERR_OK ) return self :: processError ( $ default ) ; $ file = new InputFile ( $ _FILES [ $ key ] [ 'tmp_name' ] ) ; $ file -> setContentType ( $ _FILES [ $ key ] [ 'type' ] ) ; $ file -> setOriginalName ( $ _FILES [ $ key ] [ 'name' ] ) ; if ( $ validator instanceof Validator ) { if ( $ validator -> execute ( $ file ) ) { return $ file ; } else { return self :: processError ( $ default ) ; } } else if ( is_callable ( $ validator ) ) { try { if ( $ validator ( $ file ) ) { return $ file ; } else { return self :: processError ( $ default ) ; } } catch ( Exception $ e ) { throw FrameworkException :: internalError ( "Validator error" ) ; } } return $ file ; }
Get Uploaded File

@param $key
@param null $default
@param null $validator
@return InputFile
Get Uploaded File