ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 71 of file class.ilFileUploadUtil.php.

72 {
73 // get the value for the maximal uploadable filesize from the php.ini (if available)
74 $umf = ini_get("upload_max_filesize");
75 // get the value for the maximal post data from the php.ini (if available)
76 $pms = ini_get("post_max_size");
77
78 //convert from short-string representation to "real" bytes
79 $multiplier_a=array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
80
81 $umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
82 $pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
83
84 if (count($umf_parts) == 2) {
85 $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]];
86 }
87 if (count($pms_parts) == 2) {
88 $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]];
89 }
90
91 // use the smaller one as limit
92 $max_filesize = min($umf, $pms);
93
94 if (!$max_filesize)
95 $max_filesize=max($umf, $pms);
96
97 return $max_filesize;
98 }
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 105 of file class.ilFileUploadUtil.php.

106 {
107 $max_filesize = self::getMaxFileSize();
108
109 // format for display in mega-bytes
110 return sprintf("%.1f MB", $max_filesize / 1024 / 1024);
111 }
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 $objDefinition, $ilAccess;
26
27 if (self::isUploadSupported())
28 {
29 include_once("./Services/FileUpload/classes/class.ilFileUploadSettings.php");
30
31 // repository upload enabled?
34 {
35 if ($a_type == "")
36 $a_type = ilObject::_lookupType($a_ref_id, true);
37
38 if ($objDefinition->isContainer($a_type))
39 return $ilAccess->checkAccess("create_file", "", $a_ref_id, "file");
40 }
41 }
42
43 return false;
44 }
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

References 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 51 of file class.ilFileUploadUtil.php.

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

References $_GET, $cmd, 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: