Aumento tempo alerta toast.php
This commit is contained in:
@@ -72,12 +72,38 @@ class OrderController
|
||||
|
||||
public function store()
|
||||
{
|
||||
// Detect post_max_size overflow
|
||||
if (empty($_POST) && empty($_FILES) && isset($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > 0) {
|
||||
$_SESSION['flash_error'] = "O tamanho total dos arquivos enviados excede o limite permitido pelo servidor.";
|
||||
View::redirect('/admin/orders/create');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($_FILES['csv_file']) || $_FILES['csv_file']['error'] !== UPLOAD_ERR_OK) {
|
||||
$_SESSION['flash_error'] = "Erro no upload do arquivo CSV.";
|
||||
View::redirect('/admin/orders/create');
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate attachments before inserting the order
|
||||
if (isset($_FILES['attachments']) && !empty($_FILES['attachments']['name'][0])) {
|
||||
$attachments = $_FILES['attachments'];
|
||||
$count = count($attachments['name']);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$error = $attachments['error'][$i];
|
||||
if ($error !== UPLOAD_ERR_OK && $error !== UPLOAD_ERR_NO_FILE) {
|
||||
$fileName = $attachments['name'][$i];
|
||||
if ($error === UPLOAD_ERR_INI_SIZE || $error === UPLOAD_ERR_FORM_SIZE) {
|
||||
$_SESSION['flash_error'] = "O anexo '{$fileName}' excede o tamanho máximo permitido.";
|
||||
} else {
|
||||
$_SESSION['flash_error'] = "Erro no upload do anexo '{$fileName}': código {$error}.";
|
||||
}
|
||||
View::redirect('/admin/orders/create');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$title = $_POST['title'];
|
||||
$type = $_POST['type'];
|
||||
$content = \App\Utils\TextFormatter::normalizeLineBreaks($_POST['content']);
|
||||
|
||||
Reference in New Issue
Block a user