Better checking of existing value, in case it's not in the list

This commit is contained in:
moodler
2002-12-07 04:00:05 +00:00
parent 0fa2146388
commit ff4f23fdcc
+5 -1
View File
@@ -77,14 +77,18 @@
<?
$sizelist = array("10Kb", "50Kb", "100Kb", "500Kb", "1Mb", "2Mb", "5Mb", "10Mb", "20Mb", "50Mb");
$maxsize = get_max_upload_file_size();
$sizeinlist = false;
foreach ($sizelist as $size) {
$sizebytes = get_real_size($size);
if ($sizebytes < $maxsize) {
$filesize[$sizebytes] = $size;
}
if ($form->maxbytes == $sizebytes) {
$sizeinlist = true;
}
}
$filesize[$maxsize] = display_size($maxsize);
if (!$form->maxbytes) {
if (!$sizeinlist) {
$form->maxbytes = get_real_size("500K");
}
ksort($filesize, SORT_NUMERIC);