ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
static isUploadSupported ()
 Determines whether file upload is supported at the current location.
static getMaxFileSize ()
 Gets the maximum upload file size allowed in bytes.
static getMaxFileSizeString ()
 Gets the maximum upload file size allowed as string (like '14.2 MB').

Detailed Description

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

Member Function Documentation

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.

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

{
// get the value for the maximal uploadable filesize from the php.ini (if available)
$umf = ini_get("upload_max_filesize");
// get the value for the maximal post data from the php.ini (if available)
$pms = ini_get("post_max_size");
//convert from short-string representation to "real" bytes
$multiplier_a=array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
$umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
if (count($umf_parts) == 2) {
$umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]];
}
if (count($pms_parts) == 2) {
$pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]];
}
// use the smaller one as limit
$max_filesize = min($umf, $pms);
if (!$max_filesize)
$max_filesize=max($umf, $pms);
return $max_filesize;
}

+ Here is the caller graph for this function:

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.

References getMaxFileSize().

{
$max_filesize = self::getMaxFileSize();
// format for display in mega-bytes
return sprintf("%.1f MB", $max_filesize / 1024 / 1024);
}

+ Here is the call graph for this function:

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.

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

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

{
global $objDefinition, $ilAccess;
if (self::isUploadSupported())
{
include_once("./Services/FileUpload/classes/class.ilFileUploadSettings.php");
// repository upload enabled?
{
if ($a_type == "")
$a_type = ilObject::_lookupType($a_ref_id, true);
if ($objDefinition->isContainer($a_type))
return $ilAccess->checkAccess("create_file", "", $a_ref_id, "file");
}
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References $_GET, $cmd, and $ilCtrl.

Referenced by ilFileUploadGUI\getUploadUrl().

{
global $ilCtrl;
// right now, only the repository is supported
if (strtolower($_GET["baseClass"]) == "ilrepositorygui")
{
$cmd = $ilCtrl->getCmd();
if ($cmd == "" || $cmd == "view" || $cmd == "render")
return true;
}
return false;
}

+ Here is the caller graph for this function:


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