Update posting_attachments.php

This commit is contained in:
Roman Kelesidis 2023-12-21 11:52:08 +07:00
parent 626a89185b
commit ef2e2a7e64

View File

@ -843,6 +843,37 @@ class attach_parent
$file = $_FILES['fileupload']['tmp_name'];
$this->type = $_FILES['fileupload']['type'];
if (isset($_FILES['fileupload']['error']))
{
switch ($_FILES['fileupload']['error'])
{
case UPLOAD_ERR_NO_FILE:
bb_die('No file content sent');
break;
case UPLOAD_ERR_INI_SIZE:
bb_die('upload_max_filesize setting: ' . ini_get('upload_max_filesize'));
break;
case UPLOAD_ERR_FORM_SIZE:
bb_die('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form');
break;
case UPLOAD_ERR_CANT_WRITE:
bb_die('Failed to write file to disk, check permissions');
break;
case UPLOAD_ERR_PARTIAL:
bb_die('The uploaded file was only partially uploaded');
break;
case UPLOAD_ERR_EXTENSION:
bb_die('File upload stopped by extension');
break;
case UPLOAD_ERR_NO_TMP_DIR:
bb_die('Missing a temporary folder');
break;
default:
bb_die('Unknown upload error');
break;
}
}
if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] == 0)
{
bb_die('Tried to upload empty file');