public function testShorthandSize() { $this->assertSame(1 * MB_IN_BYTES, convert_shorthand_size_to_bytes('1m')); $this->assertSame(1 * MB_IN_BYTES, convert_shorthand_size_to_bytes('1m')); $this->assertSame(1 * KB_IN_BYTES, convert_shorthand_size_to_bytes('1k')); $this->assertSame(1 * KB_IN_BYTES, convert_shorthand_size_to_bytes('1K')); $this->assertSame(1 * GB_IN_BYTES, convert_shorthand_size_to_bytes('1g')); $this->assertSame(1 * GB_IN_BYTES, convert_shorthand_size_to_bytes('1G')); }
/** * Get the maximum upload size in bytes * * @return int */ function get_max_upload_size() { $maxUploadSize = convert_shorthand_size_to_bytes(ini_get('upload_max_filesize')); $maxPostSize = convert_shorthand_size_to_bytes(ini_get('post_max_size')); return min($maxUploadSize, $maxPostSize); }