Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP function to know upload_max_filesize

I'v searching for a while in php.net and I don't find what I'm searching. I need a function to know the max_upload_filesize from a PHP function.

Here what I need: http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize

Thanks in advance!

like image 372
Marc Avatar asked Jun 03 '10 14:06

Marc


People also ask

What is post max size PHP?

The default PHP values are 2 MB for upload_max_filesize, and 8 MB for post_max_size.

What is upload_max_filesize and Post_max_size?

upload_max_filesize is the maximum size of an uploaded file. This is the limit for a SINGLE file. post_max_size, on the other hand, is the limit of the entire body of the request (which may include multiple files as well as other stuff).


2 Answers

Use ini_get() function:

<?php
$upload_max_size = ini_get('upload_max_filesize');
like image 117
vartec Avatar answered Sep 22 '22 15:09

vartec


In addition to upload_max_filesize, watch out for post_max_size. Whichever is the smaller will be enforced

like image 32
Mark Baker Avatar answered Sep 23 '22 15:09

Mark Baker