Sunday, November 15, 2015

Form File Upload Limits With PHP

$arrayMaxes = array(
    'upload_max_filesize' => intval(ini_get('upload_max_filesize')),
    'post_max_size' => intval(ini_get('post_max_size')),
    'memory_limit' => intval(ini_get('memory_limit'))
);
$maxUploadSize = min($arrayMaxes);
foreach ($arrayMaxes as $key => $value) {
    if ($value == min($arrayMaxes)) {
        $minimumOfThree = $key;
        break;
    }
}

echo "The maximum file size you can upload is $maxUploadSize, this is due to the php.ini setting $mininimumOfThree";

Credit : http://edmondscommerce.github.io/php/form-file-upload-limits-with-php.html

No comments:

Post a Comment