summaryrefslogtreecommitdiff
path: root/forum/utils/filehandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'forum/utils/filehandler.php')
-rw-r--r--forum/utils/filehandler.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/forum/utils/filehandler.php b/forum/utils/filehandler.php
index 9cacb1c..dfe0c80 100644
--- a/forum/utils/filehandler.php
+++ b/forum/utils/filehandler.php
@@ -4,10 +4,13 @@ include_once($UTIL_DIR . "/files.php");
$files = new Files($DATA_DIR . "/files.xml");
if($task == "upload") {
+
if(is_uploaded_file($_FILES['userfile']['tmp_name'])) {
$name = $filename;
if(!$filename) $name = $_FILES['userfile']['name'];
- $files->newFile($_FILES['userfile']['tmp_name'], $name);
+ if(filesize($_FILES['userfile']['tmp_name']) <= $FILE_MAX_SIZE) $files->newFile($_FILES['userfile']['tmp_name'], $name);
+ else echo "File is too big " . sprintf("%.0f", filesize($_FILES['userfile']['tmp_name'])/1024).
+ "kb, max file size: " . sprintf("%.0f", $FILE_MAX_SIZE/1024) . "kb.";
}
}