From 3753951056d505cf82a3e8ff71495af88c6e1d2d Mon Sep 17 00:00:00 2001 From: s-ko Date: Sat, 27 Sep 2014 20:43:22 +0100 Subject: [PATCH] Added maximum upload size display --- index.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 513d7d1..715b4ff 100644 --- a/index.php +++ b/index.php @@ -52,7 +52,7 @@ // Display debugging information - debug => false + debug => $_SERVER['SERVER_NAME'] === 'localhost' ); @@ -66,6 +66,12 @@ // URL to upload page $data['pageurl'] = "http" . (($_SERVER['SERVER_PORT']==443) ? "s://" : "://") . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . '/'; + // Use canonized path + $data['uploaddir'] = realpath($settings['uploaddir']); + + // Maximum upload size, set by system + $data['max_upload_size'] = ini_get('upload_max_filesize'); + if ($settings['debug']) { // Enabling error reporting error_reporting(E_ALL); @@ -107,7 +113,7 @@ if ($settings['random_name_keep_type']) $data['target_file_name'] .= '.' . pathinfo($data['uploaded_file_name'], PATHINFO_EXTENSION); } - $data['upload_target_file'] = $settings['uploaddir'] . DIRECTORY_SEPARATOR . $data['target_file_name']; + $data['upload_target_file'] = $data['uploaddir'] . DIRECTORY_SEPARATOR . $data['target_file_name']; $data['tmp_name'] = $_FILES['file']['tmp_name']; if ($settings['debug']) { @@ -305,6 +311,10 @@ +

Simple PHP Upload

+

+ Maximum upload size: +

Choose File:
-- 2.39.5