lib/ezutils/classes/ezhttpfile.php
static function canFetch( $httpName, $maxSize = false )
    {
        if ( !isset( $GLOBALS["eZHTTPFile-$httpName"] ) ||
             !( $GLOBALS["eZHTTPFile-$httpName"] instanceof eZHTTPFile ) )
        {
            if ( $maxSize === false )
            {
                return isset( $_FILES[$httpName] ) and $_FILES[$httpName]['name'] != "" and $_FILES[$httpName]['error'] == 0;
            }

            if ( isset( $_FILES[$httpName] ) and $_FILES[$httpName]['name'] != "" )
            {
                switch ( $_FILES[$httpName]['error'] )
                {
                    case ( UPLOAD_ERR_NO_FILE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST;
                    }break;

                    case ( UPLOAD_ERR_INI_SIZE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT;
                    }break;

                    case ( UPLOAD_ERR_FORM_SIZE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE;
                    }break;

                    case ( UPLOAD_ERR_NO_TMP_DIR ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_MISSING_TMP_DIR;
                    }break;

                    case ( UPLOAD_ERR_CANT_WRITE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_CANT_WRITE;
                    }break;

                    case ( 0 ):
                    {
                        return ( $maxSize == 0 || $_FILES[$httpName]['size'] <= $maxSize )? eZHTTPFile::UPLOADEDFILE_OK:
                                                                                             eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE;
                    }break;

                    default:
                    {
                        return eZHTTPFile::UPLOADEDFILE_UNKNOWN_ERROR;
                    }
                }
            }
            else
            {
                return eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST;
            }
        }
        if ( $maxSize === false )
            return eZHTTPFile::UPLOADEDFILE_OK;
        else
            return true;
    }
static function canFetch( $httpName, $maxSize = false )
    {
        if ( !isset( $GLOBALS["eZHTTPFile-$httpName"] ) ||
             !( $GLOBALS["eZHTTPFile-$httpName"] instanceof eZHTTPFile ) )
        {
            if ( $maxSize === false )
            {
                return isset( $_FILES[$httpName] ) and $_FILES[$httpName]['name'] != "" and $_FILES[$httpName]['error'] == 0;
            }

            if ( isset( $_FILES[$httpName] ) and $_FILES[$httpName]['name'] != "" )
            {
                switch ( $_FILES[$httpName]['error'] )
                {
                    case ( UPLOAD_ERR_NO_FILE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST;
                    }break;

                    case ( UPLOAD_ERR_INI_SIZE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT;
                    }break;

                    case ( UPLOAD_ERR_FORM_SIZE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE;
                    }break;

                    case ( UPLOAD_ERR_NO_TMP_DIR ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_MISSING_TMP_DIR;
                    }break;

                    case ( UPLOAD_ERR_CANT_WRITE ):
                    {
                        return eZHTTPFile::UPLOADEDFILE_CANT_WRITE;
                    }break;

                    case ( 0 ):
                    {
                        return ( $maxSize == 0 || $_FILES[$httpName]['size'] <= $maxSize )? eZHTTPFile::UPLOADEDFILE_OK:
                                                                                             eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE;
                    }break;

                    default:
                    {
                        return eZHTTPFile::UPLOADEDFILE_UNKNOWN_ERROR;
                    }
                }
            }
            else
            {
                return eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST;
            }
        }
        if ( $maxSize === false )
            return eZHTTPFile::UPLOADEDFILE_OK;
        else
            return true;
    }
static function canFetch ( $ httpName , $ maxSize = false ) { if ( ! isset ( $ GLOBALS [ "eZHTTPFile-$httpName" ] ) || ! ( $ GLOBALS [ "eZHTTPFile-$httpName" ] instanceof eZHTTPFile ) ) { if ( $ maxSize === false ) { return isset ( $ _FILES [ $ httpName ] ) and $ _FILES [ $ httpName ] [ 'name' ] != "" and $ _FILES [ $ httpName ] [ 'error' ] == 0 ; } if ( isset ( $ _FILES [ $ httpName ] ) and $ _FILES [ $ httpName ] [ 'name' ] != "" ) { switch ( $ _FILES [ $ httpName ] [ 'error' ] ) { case ( UPLOAD_ERR_NO_FILE ) : { return eZHTTPFile :: UPLOADEDFILE_DOES_NOT_EXIST ; } break ; case ( UPLOAD_ERR_INI_SIZE ) : { return eZHTTPFile :: UPLOADEDFILE_EXCEEDS_PHP_LIMIT ; } break ; case ( UPLOAD_ERR_FORM_SIZE ) : { return eZHTTPFile :: UPLOADEDFILE_EXCEEDS_MAX_SIZE ; } break ; case ( UPLOAD_ERR_NO_TMP_DIR ) : { return eZHTTPFile :: UPLOADEDFILE_MISSING_TMP_DIR ; } break ; case ( UPLOAD_ERR_CANT_WRITE ) : { return eZHTTPFile :: UPLOADEDFILE_CANT_WRITE ; } break ; case ( 0 ) : { return ( $ maxSize == 0 || $ _FILES [ $ httpName ] [ 'size' ] <= $ maxSize ) ? eZHTTPFile :: UPLOADEDFILE_OK : eZHTTPFile :: UPLOADEDFILE_EXCEEDS_MAX_SIZE ; } break ; default : { return eZHTTPFile :: UPLOADEDFILE_UNKNOWN_ERROR ; } } } else { return eZHTTPFile :: UPLOADEDFILE_DOES_NOT_EXIST ; } } if ( $ maxSize === false ) return eZHTTPFile :: UPLOADEDFILE_OK ; else return true ; }
Returns whether a file can be fetched.

@param string $httpName Name of the file.
@param bool|int Whether a maximum file size applies or size in bytes of the maximum allowed.

@return bool|int true if the HTTP file $httpName can be fetched. If $maxSize is given,
the function returns
eZHTTPFile::UPLOADEDFILE_OK if the file can be fetched,
eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST if there has been no file uploaded,
eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT if the file was uploaded but size
exceeds the upload_max_size limit (set in the PHP configuration),
eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE if the file was uploaded but size
exceeds $maxSize or MAX_FILE_SIZE variable in the form.
eZHTTPFile::UPLOADEDFILE_MISSING_TMP_DIR if the temporary directory is missing
eZHTTPFile::UPLOADEDFILE_CANT_WRITE if the file can't be written
eZHTTPFile::UPLOADEDFILE_UNKNOWN_ERROR if an unknown error occured
Returns whether a file can be fetched .