Returns the value (in bytes) for the maximum file upload size of the current user.<p>

@param cms the initialized CmsObject

@return the value (in bytes) for the maximum file upload size
495140
public long getFileBytesMaxUploadSize(CmsObject cms) {

        int maxFileSize = getFileMaxUploadSize();
        long maxFileSizeBytes = maxFileSize * 1024;
        // check if current user belongs to Admin group, if so no file upload limit
        if ((maxFileSize <= 0) || OpenCms.getRoleManager().hasRole(cms, CmsRole.VFS_MANAGER)) {
            maxFileSizeBytes = -1;
        }
        return maxFileSizeBytes;
    }
391245
private CmsObject getClonedCmsObject(CmsObject cms) throws CmsException {

        CmsObject clonedCms = OpenCms.initCmsObject(cms);
        // only online images get caches
        clonedCms.getRequestContext().setCurrentProject(clonedCms.readProject(CmsProject.ONLINE_PROJECT_ID));
        // paths are always root path
        clonedCms.getRequestContext().setSiteRoot("");

        return clonedCms;
    }
350818
public static function getMaxUploadSize()
    {
        if (!ini_get('file_uploads')) {
            return 0;
        }

        $max = 0;

        try {
            $max = FormUtils::sizeToBytes(ini_get('upload_max_filesize'));
        } catch (\Exception $e) {
        }

        try {
            $max2 = FormUtils::sizeToBytes(ini_get('post_max_size'));
            if ($max2 < $max || $max == 0) {
                $max = $max2;
            }
        } catch (\Exception $e) {
        }

        return $max;
    }
761944
public static function maxUpload() {
        $maxUpload = (int)(ini_get('upload_max_filesize'));
        $max_post = (int)(ini_get('post_max_size'));
        $memory_limit = (int)(ini_get('memory_limit'));
        $upload_mb = min($maxUpload, $max_post, $memory_limit);
        return $upload_mb;
    }
1010044
public CmsPathValue getPathValue() {

        if (!CmsStringUtil.isEmpty(m_structureValue)) {
            return new CmsPathValue(m_structureValue, PATH_STRUCTURE_VALUE);
        } else if (!CmsStringUtil.isEmpty(m_resourceValue)) {
            return new CmsPathValue(m_resourceValue, PATH_RESOURCE_VALUE);
        } else {
            return new CmsPathValue(null, PATH_STRUCTURE_VALUE);
        }
    }
641681
public CmsFile getFile() {

        if ((m_file == null) && !isFolder()) {
            try {
                m_file = m_cms.readFile(this);
            } catch (CmsException e) {
                // this should not happen since we are updating from a resource object
            }
        }
        return m_file;
    }
744531
public I_CmsEditHandler getEditHandler(CmsObject cms) {

        String schema = getSchema();

        try {
            CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema);
            // get the content handler for the resource type to create
            I_CmsXmlContentHandler handler = contentDefinition.getContentHandler();
            return handler.getEditHandler();

        } catch (CmsXmlException e) {
            LOG.error(e.getMessage(), e);
        }
        return null;
    }
763528
private function getUploadMaxFileSize()
    {
        $postMaxSize = trim(ini_get('post_max_size'));

        if ('' === $postMaxSize) {
            $postMaxSize = PHP_INT_MAX;
        }

        switch (strtolower(substr($postMaxSize, -1))) {
            /** @noinspection PhpMissingBreakStatementInspection */
            case 'g':
                $postMaxSize *= 1024;
            /** @noinspection PhpMissingBreakStatementInspection */
            case 'm':
                $postMaxSize *= 1024;
            case 'k':
                $postMaxSize *= 1024;
        }

        return min(UploadedFile::getMaxFilesize(), (int) $postMaxSize);
    }
834084
public static String getInvalidFileSizeMessage(final long maxFileSize) {
		return String.format(I18nUtilities.format(null, InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_SIZE),
			FileUtil.readableFileSize(maxFileSize));
	}
431673
private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {

        if (!m_enabled) {
            return CmsTemplateMapperConfiguration.EMPTY_CONFIG;
        }

        if (m_configPath == null) {
            m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, "template-mapping.xml");
        }

        return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
            cms,
            m_configPath,
            new Transformer() {

                @Override
                public Object transform(Object input) {

                    try {
                        CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);
                        SAXReader saxBuilder = new SAXReader();
                        try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {
                            Document document = saxBuilder.read(stream);
                            CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);
                            return config;
                        }
                    } catch (Exception e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                        return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything
                    }

                }
            }));
    }
1242583
public static function maxBytesUpload ()
		{
			$values = [
				ini_get('post_max_size'),
				ini_get('upload_max_filesize'),
				ini_get('memory_limit'),
			];

			$min = false;
			foreach ($values as $v)
			{
				if ($v != -1)
				{
					$bytes = self::toBytes($v);
					if ($bytes != null)
						$min = $min ? min($min, $bytes) : $bytes;
				}
			}

			return $min ? $min : null;
		}
719960
protected CmsResource getResource(CmsObject cms, I_CmsWidgetParameter param) {

        I_CmsXmlContentValue value = (I_CmsXmlContentValue)param;
        CmsFile file = value.getDocument().getFile();
        String resourceName = cms.getSitePath(file);
        if (CmsWorkplace.isTemporaryFile(file)) {
            StringBuffer result = new StringBuffer(resourceName.length() + 2);
            result.append(CmsResource.getFolderPath(resourceName));
            result.append(CmsResource.getName(resourceName).substring(1));
            resourceName = result.toString();
        }
        try {
            List<CmsResource> listsib = cms.readSiblings(resourceName, CmsResourceFilter.ALL);
            for (int i = 0; i < listsib.size(); i++) {
                CmsResource resource = listsib.get(i);
                // get the default locale of the resource
                Locale locale = getDefaultLocale(cms, cms.getSitePath(resource));
                if (locale.equals(value.getLocale())) {
                    // get the property for the right locale
                    return resource;
                }
            }
        } catch (CmsVfsResourceNotFoundException e) {
            // may hapen if editing a new resource
            if (LOG.isDebugEnabled()) {
                LOG.debug(e.getLocalizedMessage(), e);
            }
        } catch (CmsException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return file;
    }
1153418
public String getUserLastModifiedName(CmsObject cms) {

        try {
            return CmsPrincipal.readPrincipalIncludingHistory(cms, getUserLastModified()).getName();
        } catch (CmsException e) {
            return getUserLastModified().toString();
        }
    }
177245
public String getRepositoryBaseFolderName(CmsObject cms) {

        String value = "";
        try {
            value = cms.readPropertyObject(
                CmsCategoryService.CENTRALIZED_REPOSITORY,
                CmsPropertyDefinition.PROPERTY_DEFAULT_FILE,
                false).getValue();
        } catch (CmsException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
            value = OpenCms.getWorkplaceManager().getCategoryFolder();
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
            value = REPOSITORY_BASE_FOLDER;
        }
        if (!value.endsWith("/")) {
            value += "/";
        }
        if (!value.startsWith("/")) {
            value = "/" + value;
        }
        return value;
    }
167663
private String getSingleSize(CmsObject cms, CmsResource res) {

        try {
            BufferedImage img = Simapi.read(cms.readFile(res).getContents());
            return "" + img.getWidth() + " x " + img.getHeight() + "px";
        } catch (CmsException | IOException e) {
            return "";
        }
    }
1315948
public CmsFile getFile() {

        if (m_base instanceof CmsFile) {
            CmsFile file = (CmsFile)m_base;

            return new CmsFile(
                file.getStructureId(),
                file.getResourceId(),
                m_rootPath,
                m_typeId,
                file.getFlags(),
                file.getProjectLastModified(),
                file.getState(),
                file.getDateCreated(),
                file.getUserCreated(),
                file.getDateLastModified(),
                file.getUserLastModified(),
                file.getDateReleased(),
                file.getDateExpired(),
                file.getSiblingCount(),
                file.getLength(),
                file.getDateContent(),
                file.getVersion(),
                file.getContents());
        }

        return new CmsFile(getResource());
    }
226011
protected long calculateContentLength() {

        int result = 0;
        for (CmsFileInfo file : getFilesToUpload().values()) {
            result += file.getFileSize();
        }
        return new Long(result).longValue();
    }