public static function uploadSize(array $file, $size) { // upload failed if ($file['error'] !== UPLOAD_ERR_OK) { return false; } // upload larger than upload_max_filesize if ($file['error'] === UPLOAD_ERR_INI_SIZE) { return false; } return $file['size'] <= to_bytes($size); }
if (!value) return; if (!value.match(pattern)) { alert("The font name specified for "+name+" is not a TrueType font"); ok = false; return false; } }); return ok; } </script> <?php if (auth_ok()) { $max_size = min(to_bytes(ini_get('post_max_size')), to_bytes(ini_get('upload_max_filesize'))); ?> <form name="upload-font" method="post" action="controller.php?cmd=install-font" target="upload-font" enctype="multipart/form-data" onsubmit="return checkFileName(this)"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size; ?> " /> <table class="setup"> <tr> <td class="title">Name</td> <td><input type="text" name="family" /></td> <td rowspan="6"><iframe name="upload-font" id="upload-font" style="border: 0; width: 500px;"></iframe></td> </tr> <tr>
/** * @author Han Lin Yap < http://zencodez.net/ > * @copyright 2011 zencodez.net * @license http://creativecommons.org/licenses/by-sa/3.0/ * @version 1.0 - 2011-01-12 */ function server_maxupload() { return min(to_bytes(ini_get('post_max_size')), to_bytes(ini_get('upload_max_filesize'))); }