26 $objDefinition =
$DIC[
'objDefinition'];
27 $ilAccess =
$DIC[
'ilAccess'];
29 if (self::isUploadSupported()) {
30 include_once(
"./Services/FileUpload/classes/class.ilFileUploadSettings.php");
39 if ($objDefinition->isContainer($a_type)) {
40 return $ilAccess->checkAccess(
"create_file",
"", $a_ref_id,
"file");
56 $ilCtrl =
$DIC[
'ilCtrl'];
59 if (strtolower(
$_GET[
"baseClass"]) ==
"ilrepositorygui") {
60 $cmd = $ilCtrl->getCmd();
61 if ($cmd ==
"" || $cmd ==
"view" || $cmd ==
"render") {
77 $umf = ini_get(
"upload_max_filesize");
79 $pms = ini_get(
"post_max_size");
82 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024);
84 $umf_parts = preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
85 $pms_parts = preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
87 if (count($umf_parts) == 2) {
88 $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
90 if (count($pms_parts) == 2) {
91 $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
95 $max_filesize = min($umf, $pms);
98 $max_filesize = max($umf, $pms);
101 return $max_filesize;
114 return sprintf(
"%.1f MB", $max_filesize / 1024 / 1024);
An exception for terminatinating execution or to throw for unit testing.
static isRepositoryDragAndDropUploadEnabled()
Gets whether drag and drop file upload in the repository is enabled.
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.
static getMaxFileSize()
Gets the maximum upload file size allowed in bytes.
static isUploadSupported()
Determines whether file upload is supported at the current location.
static isUploadAllowed($a_ref_id, $a_type="")
Determines whether files can be uploaded to the object with the specified reference id.
static getMaxFileSizeString()
Gets the maximum upload file size allowed as string (like '14.2 MB').
static _lookupType($a_id, $a_reference=false)
lookup object type