private static function getUploadMaxFileSizeInBytes() {
    $val = trim(ini_get('upload_max_filesize'));
    $unit = strtolower(substr($val, -1));
    switch ($unit) {
      case 'g':
        $val *= 1024;
        // Fall through
      case 'm':
        $val *= 1024;
        // Fall through
      case 'k':
        $val *= 1024;
        break;
    }
    return intval($val);
  }