note 22119 deleted from features.file-upload by philip

From: Date: Sat, 15 Feb 2003 15:37:22 +0000
Subject: note 22119 deleted from features.file-upload by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-43994@lists.php.net to get a copy of this message
Hi, To get the max upload filesize i use this <?php echo get_max_upload(); function get_max_upload() { if (!ini_get("file_uploads")) { return FALSE; } $upload_max_filesize = get_real_size(ini_get("upload_max_filesize")); $post_max_size = get_real_size(ini_get("post_max_size")); // http://www.php.net/manual/en/features.file-upload.php User Contributed Notes - michaelpearl@mac.com $memory_limit = round(get_real_size(ini_get("memory_limit")) / 2); // http://www.php.net/manual/en/features.file-upload.php User Contributed Notes - NOmcartmelSPAM@NOmagianSPAM.com.au if ($upload_max_filesize>$post_max_size) { $max = $post_max_size; } else { $max = $upload_max_filesize; } if (($memory_limit!="")&&($memory_limit<$max)) { // i had problems to get the "memory_limit" from the php.ini (this is testing on winXP with apache) $max = $memory_limit; } return $max; } function get_real_size($size) { if ($size=="") { return 0; } $scan['MB'] = 1048576; $scan['M'] = 1048576; $scan['KB'] = 1024; $scan['K'] = 1024; while (list($key) = each($scan)) { if ((strlen($size)>strlen($key))&&(substr($size, strlen($size) - strlen($key))==$key)) { $size = substr($size, 0, strlen($size) - strlen($key)) * $scan[$key]; break; } } return $size; } ?>

« previous php.notes (#43994) next »