ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilFileUploadUtil Class Reference
+ Collaboration diagram for ilFileUploadUtil:

Static Public Member Functions

static isUploadAllowed ($a_ref_id, $a_type="")
 Determines whether files can be uploaded to the object with the specified reference id. More...
 
static isUploadSupported ()
 Determines whether file upload is supported at the current location. More...
 
static getMaxFileSize ()
 Gets the maximum upload file size allowed in bytes. More...
 
static getMaxFileSizeString ()
 Gets the maximum upload file size allowed as string (like '14.2 MB'). More...
 

Detailed Description

Definition at line 14 of file class.ilFileUploadUtil.php.

Member Function Documentation

◆ getMaxFileSize()

static ilFileUploadUtil::getMaxFileSize ( )
static

Gets the maximum upload file size allowed in bytes.

Returns
int The maximum upload file size allowed in bytes.

Definition at line 74 of file class.ilFileUploadUtil.php.

75 {
76 // get the value for the maximal uploadable filesize from the php.ini (if available)
77 $umf = ini_get("upload_max_filesize");
78 // get the value for the maximal post data from the php.ini (if available)
79 $pms = ini_get("post_max_size");
80
81 //convert from short-string representation to "real" bytes
82 $multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
83
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);
86
87 if (count($umf_parts) == 2) {
88 $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
89 }
90 if (count($pms_parts) == 2) {
91 $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
92 }
93
94 // use the smaller one as limit
95 $max_filesize = min($umf, $pms);
96
97 if (!$max_filesize) {
98 $max_filesize = max($umf, $pms);
99 }
100
101 return $max_filesize;
102 }
echo;exit;}function LogoutNotification($SessionID){ global $ilDB;$q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE

References PREG_SPLIT_DELIM_CAPTURE.

Referenced by getMaxFileSizeString(), and ilFileUploadGUI\getSharedHtml().

+ Here is the caller graph for this function:

◆ getMaxFileSizeString()

static ilFileUploadUtil::getMaxFileSizeString ( )
static

Gets the maximum upload file size allowed as string (like '14.2 MB').

Returns
string The maximum upload file size allowed as string.

Definition at line 109 of file class.ilFileUploadUtil.php.

110 {
111 $max_filesize = self::getMaxFileSize();
112
113 // format for display in mega-bytes
114 return sprintf("%.1f MB", $max_filesize / 1024 / 1024);
115 }
static getMaxFileSize()
Gets the maximum upload file size allowed in bytes.

References getMaxFileSize().

+ Here is the call graph for this function:

◆ isUploadAllowed()

static ilFileUploadUtil::isUploadAllowed (   $a_ref_id,
  $a_type = "" 
)
static

Determines whether files can be uploaded to the object with the specified reference id.

Parameters
int$a_ref_idThe reference id to check.
string$a_typeThe type of the object to check.
Returns
bool true, if file upload is allowed; otherwise, false.

Definition at line 23 of file class.ilFileUploadUtil.php.

24 {
25 global $DIC;
26 $objDefinition = $DIC['objDefinition'];
27 $ilAccess = $DIC['ilAccess'];
28
29 if (self::isUploadSupported()) {
30 include_once("./Services/FileUpload/classes/class.ilFileUploadSettings.php");
31
32 // repository upload enabled?
35 if ($a_type == "") {
36 $a_type = ilObject::_lookupType($a_ref_id, true);
37 }
38
39 if ($objDefinition->isContainer($a_type)) {
40 return $ilAccess->checkAccess("create_file", "", $a_ref_id, "file");
41 }
42 }
43 }
44
45 return false;
46 }
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 _lookupType($a_id, $a_reference=false)
lookup object type
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92

References $a_type, $DIC, ilObject\_lookupType(), ilFileUploadSettings\isDragAndDropUploadEnabled(), and ilFileUploadSettings\isRepositoryDragAndDropUploadEnabled().

Referenced by ilObjectListGUI\isFileUploadAllowed(), and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isUploadSupported()

static ilFileUploadUtil::isUploadSupported ( )
static

Determines whether file upload is supported at the current location.

Returns
bool true, if file upload is supported; otherwise, false.

Definition at line 53 of file class.ilFileUploadUtil.php.

54 {
55 global $DIC;
56 $ilCtrl = $DIC['ilCtrl'];
57
58 // right now, only the repository is supported
59 if (strtolower($_GET["baseClass"]) == "ilrepositorygui") {
60 $cmd = $ilCtrl->getCmd();
61 if ($cmd == "" || $cmd == "view" || $cmd == "render") {
62 return true;
63 }
64 }
65
66 return false;
67 }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18

References $_GET, $DIC, and $ilCtrl.

Referenced by ilFileUploadGUI\getUploadUrl().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: