Improve debugging and error handling for chunked file uploads

This commit is contained in:
Kijin Sung 2016-12-17 21:37:30 +09:00
parent 193fab949d
commit 13b14dc7f5
5 changed files with 103 additions and 22 deletions

View file

@ -305,8 +305,15 @@ class editorModel extends editor
$file_config = $oFileModel->getUploadConfig();
$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
$file_config->allowed_chunk_size = min(FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size')) * 0.95, 100 * 1024 * 1024);
$file_config->allowed_chunk_size = floor($file_config->allowed_chunk_size / 131072) * 131072;
$file_config->allowed_chunk_size = min(FileHandler::returnBytes(ini_get('upload_max_filesize')), FileHandler::returnBytes(ini_get('post_max_size')) * 0.95, 64 * 1024 * 1024);
if ($file_config->allowed_chunk_size > 4 * 1048576)
{
$file_config->allowed_chunk_size = floor($file_config->allowed_chunk_size / 1048576) * 1048576;
}
else
{
$file_config->allowed_chunk_size = floor($file_config->allowed_chunk_size / 65536) * 65536;
}
Context::set('file_config',$file_config);
// Configure upload status such as file size