From 309466bc442b1c8dfd48c488bf5833a1274e7ff5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 15 Jan 2006 08:47:05 +0000 Subject: [PATCH] r726: Add max packet testing --- attachment.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/attachment.php b/attachment.php index 91bd790..77b2270 100755 --- a/attachment.php +++ b/attachment.php @@ -50,6 +50,10 @@ if ($_POST['do'] == 'insert') $message->error_permission(); } + // max packet size + $var = $db->query_first("SHOW VARIABLES LIKE 'max_allowed_packet'"); + $bugsys->debug("max_allowed_packet = $var[Value]"); + // create alias $FILE =& $_FILES['attachment']; @@ -72,6 +76,11 @@ if ($_POST['do'] == 'insert') // #*# put some MIME-type validation here + if (filesize($FILE['tmp_name']) > $var['Value']) + { + $message->items[] = $lang->string('The file you specified exceeds MySQL\'s maximum allowed packet.'); + } + $filedata = $bugsys->escape(file_get_contents($FILE['tmp_name']), true, true); $time = TIMENOW; -- 2.43.5