query('SELECT `Name`, `Size` FROM `SystemFile` WHERE `Id`='.$Item['Value']);
if($DbResult->num_rows > 0)
{
$DbRow = $DbResult->fetch_assoc();
return(''.$DbRow['Name'].' ('.HumanSize($DbRow['Size']).')');
} else return('');
}
function OnEdit($Item)
{
// Check max value of upload_max_filesize
// ini_set("upload_max_filesize", "100M");
//
$Output = '';
return($Output);
}
function OnLoad($Item)
{
global $Database, $Config;
$Result = 0;
//print_r($_FILES);
if(array_key_exists($Item['Name'], $_FILES) and ($_FILES[$Item['Name']]['name'] != ''))
{
if(file_exists($_FILES[$Item['Name']]['tmp_name']))
{
$FileName = substr($_FILES[$Item['Name']]['name'], strrpos($_FILES[$Item['Name']]['name'], '/'));
$Database->query('INSERT INTO SystemFile (`Name`, `Size`) VALUES ("'.$FileName.'", '.filesize($_FILES[$Item['Name']]['tmp_name']).')');
$Result = $Database->insert_id;
if(!move_uploaded_file($_FILES[$Item['Name']]['tmp_name'], $Config['UploadFileFolder'].'/'.$Result)) SystemMessage('Nahrání souboru', 'Cílová složka není dostupná!');
}
}
return($Result);
}
}
?>