Skip to content

Instantly share code, notes, and snippets.

@maxkostinevich
Created December 22, 2015 16:19
Show Gist options
  • Save maxkostinevich/c82d3450dfb864557abb to your computer and use it in GitHub Desktop.
Save maxkostinevich/c82d3450dfb864557abb to your computer and use it in GitHub Desktop.
PHP: Get Upload Filesize
<?php
// Return allowed upload filesize in MB.
function get_upload_max_filesize(){
$upload_max_filesize = (int)(ini_get('upload_max_filesize'));
$post_max_size = (int)(ini_get('post_max_size'));
$memory_limit = (int)(ini_get('memory_limit'));
$allowed_size = min($upload_max_filesize, $post_max_size, $memory_limit);
return $allowed_size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment