1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Обработка ошибки при большом размере файла (превышает значение в php.ini) fix #187

This commit is contained in:
Mzhelskiy Maxim 2015-02-20 14:33:50 +07:00
parent 0e313789e7
commit efab9e6066
3 changed files with 13 additions and 3 deletions

View file

@ -749,7 +749,7 @@ class ActionAjax extends Action
$sTmp = getRequestStr('target_tmp');
$iPage = (int)getRequestStr('page');
$iPage = $iPage < 1 ? 1 : $iPage;
$aMediaItems = array();
if ($sType) {
/**

View file

@ -304,10 +304,20 @@ class ModuleMedia extends ModuleORM
public function UploadLocal($aFile, $sTargetType, $sTargetId, $sTargetTmp = null)
{
if (!is_array($aFile) || !isset($aFile['tmp_name']) || !isset($aFile['name']) || !isset($aFile['size'])) {
if (!is_array($aFile) || !isset($aFile['error']) || !isset($aFile['tmp_name']) || !is_string($aFile['tmp_name']) || !isset($aFile['name']) || !isset($aFile['size'])) {
return false;
}
if ($aFile['error'] != UPLOAD_ERR_OK) {
switch ($aFile['error']) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
return $this->Lang_Get('media.error.too_large', array('size' => @func_init_return_bytes(ini_get('upload_max_filesize')) / 1024));
default:
return $this->Lang_Get('media.error.upload');
}
}
$aPathInfo = pathinfo($aFile['name']);
$sExtension = isset($aPathInfo['extension']) ? $aPathInfo['extension'] : 'unknown';
$sFileName = $aPathInfo['filename'] . '.' . $sExtension;

@ -1 +1 @@
Subproject commit 586371a8cd5dbadc29c72a1d7eaab984a097a7ab
Subproject commit 28e64d5444b5340c37174e9472e3a0552aa761d8