diff --git a/ext/upload/theme.php b/ext/upload/theme.php index d3e12630..0a3f2033 100644 --- a/ext/upload/theme.php +++ b/ext/upload/theme.php @@ -43,6 +43,8 @@ class UploadTheme extends Themelet $tl_enabled = ($config->get_string(UploadConfig::TRANSLOAD_ENGINE, "none") != "none"); $max_size = $config->get_int(UploadConfig::SIZE); $max_kb = to_shorthand_int($max_size); + $max_total_size = parse_shorthand_int(ini_get('post_max_size')) - 102400; //leave room for http request data + $max_total_kb = to_shorthand_int($max_total_size); $upload_list = $this->h_upload_list_1(); $form = SHM_FORM("upload", "POST", true, "file_upload"); @@ -58,6 +60,10 @@ class UploadTheme extends Themelet TD(["colspan"=>"5"], INPUT(["name"=>"source", "type"=>"text"])) ), $upload_list, + TR( + TD(["colspan"=>$tl_enabled ? 2 : 4,"id"=>"upload_size_tracker"], ""), + TD(["colspan"=>2], ""), + ), TR( TD(["colspan"=>"6"], INPUT(["id"=>"uploadbutton", "type"=>"submit", "value"=>"Post"])) ), @@ -65,7 +71,62 @@ class UploadTheme extends Themelet ); $html = emptyHTML( $form, - SMALL("(Max file size is $max_kb)") + SMALL("(Max file size is $max_kb)"), + SMALL(BR(), "(Max total size is $max_total_kb)"), + rawHTML("") ); $page->set_title("Upload"); @@ -96,7 +157,7 @@ class UploadTheme extends Themelet for ($i=0; $i<$upload_count; $i++) { $upload_list->appendChild( TR( - TD(["colspan"=>$tl_enabled ? 2 : 4], INPUT(["type"=>"file", "name"=>"data{$i}[]", "accept"=>$accept, "multiple"=>true])), + TD(["colspan"=>$tl_enabled ? 2 : 4], DIV(["name"=>"canceldata{$i}[]","style"=>"display:inline;margin-right:5px;font-size:15px;visibility:hidden;","onclick"=>"$(\"input[name='data{$i}[]']\")[0].value='';updateTracker();"],"✖"), INPUT(["type"=>"file", "name"=>"data{$i}[]", "accept"=>$accept, "multiple"=>true])), $tl_enabled ? TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"url{$i}"])) : emptyHTML(), TD(["colspan"=>"2"], INPUT(["type"=>"text", "name"=>"tags{$i}", "class"=>"autocomplete_tags", "autocomplete"=>"off"])), ) @@ -203,7 +264,7 @@ class UploadTheme extends Themelet ) )); - $html = emptyHTML( + $html = html_entity_decode((string)emptyHTML( P( "Replacing Post ID $image_id", BR(), @@ -213,7 +274,7 @@ class UploadTheme extends Themelet BR(), $form, SMALL("(Max file size is $max_kb)"), - ); + )); $page->set_title("Replace Post"); $page->set_heading("Replace Post"); @@ -260,6 +321,8 @@ class UploadTheme extends Themelet $max_size = $config->get_int(UploadConfig::SIZE); $max_kb = to_shorthand_int($max_size); + $max_total_size = parse_shorthand_int(ini_get('post_max_size')) - 102400; //leave room for http request data + $max_total_kb = to_shorthand_int($max_total_size); // $form = SHM_FORM("upload", "POST", true); @@ -275,6 +338,7 @@ class UploadTheme extends Themelet ["class"=>'mini_upload'], $form, SMALL("(Max file size is $max_kb)"), + SMALL(BR(),"(Max total size is $max_total_kb)"), NOSCRIPT(BR(), A(["href"=>make_link("upload")], "Larger Form")) ); }