Copy this code and paste it in your HTML
<?php
// TESTED:
function getMaxFileUploadSize() {
$maxPost = ini_get('post_max_size'); if (substr($maxPost,-1) == 'K') $maxPost = substr($maxPost,0,-1) * 1024; elseif (substr($maxPost,-1) == 'M') $maxPost = substr($maxPost,0,-1) * 1024 * 1024; elseif (substr($maxPost,-1) == 'G') $maxPost = substr($maxPost,0,-1) * 1024 * 1024 * 1024; $maxUpload = ini_get('upload_max_filesize'); if (substr($maxUpload,-1) == 'K') $maxUpload = substr($maxUpload,0,-1) * 1024; elseif (substr($maxUpload,-1) == 'M') $maxUpload = substr($maxUpload,0,-1) * 1024 * 1024; elseif (substr($maxUpload,-1) == 'G') $maxUpload = substr($maxUpload,0,-1) * 1024 * 1024 * 1024; $maxFileSize = min($maxPost, $maxUpload); $maxFileSize = floor($maxFileSize / 1024 / 1024) . 'MB'; return $maxFileSize;
}
// UNTESTED
function getMaxFileUploadSize() {
$maxPost = _interpretKMG
(ini_get('post_max_size')); $maxUpload = _interpretKMG
(ini_get('upload_max_filesize')); $maxFileSize = min($maxPost, $maxUpload); $maxFileSize = floor($maxFileSize / 1024 / 1024) . 'MB'; }
function _interpretKMG($text) {
return $text;
}
switch ($suffix) {
case 'G': $num *= 1024;
case 'M': $num *= 1024;
case 'K': $num *= 1024;
}
return $num;
}