I'm using ini_get('upload_max_filesize')
to get the max file upload size.
The result is 5M
.
What is the easiest way to get this in bytes?
Using Plugin MethodGo to your WordPress Dashboard → Plugins → Add new, search “Increase Max Upload Filesize”, then Install and Activate the plugin. Once installed, go to plugin settings and simply enter the value for upload size. Click the Save Changes button to apply the new upload size.
The maximum file size limit for uploads to Box varies depending on your account type: Free personal: 250 MB. Starter: 2 GB. Business: 5 GB.
Open the MultiPHP INI editor and select a location from the dropdown. Scroll to the entry for upload_max_filesize and edit the associated value. Ensure that the value for post_max_size is larger than upload_max_filesize, and click apply at the bottom of the page.
You could use the return_bytes from the documentation:
function return_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= (1024 * 1024 * 1024); //1073741824
break;
case 'm':
$val *= (1024 * 1024); //1048576
break;
case 'k':
$val *= 1024;
break;
}
return $val;
}
return_bytes(ini_get('post_max_size'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With