PHP Max Upload Size

NamecheapNamecheap
Watch

Ik

Quality //VIP Member
Impact
8
Hello PHP Gurus,

I have 2 questions.

1- How can I display the php.ini max. file upload limit on my page?
2- Is there a way to change that limit without having to directly accessing the php.ini, or using htaccess?

Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
1- How can I display the php.ini max. file upload limit on my page?

Code:
<?php echo ini_get('upload_max_filesize'); ?>

2- Is there a way to change that limit without having to directly accessing the php.ini, or using htaccess?

I don't think so. You could try ini_set(), but I think that by the time the script executes it is too late.

There are other factors which influence the maximum file size that can be uploaded, such as the "post_max_size" setting, and also settings in the web server which may limit maximum upload sizes.
 
0
•••
Code:
<?php echo ini_get('upload_max_filesize'); ?>



I don't think so. You could try ini_set(), but I think that by the time the script executes it is too late.

There are other factors which influence the maximum file size that can be uploaded, such as the "post_max_size" setting, and also settings in the web server which may limit maximum upload sizes.

Great. Thanks a lot
 
0
•••
ini_get is worth a try.

Though, in most cases, you'll have to modify the php.ini file's max.
 
0
•••
0
•••
0
•••
You can typically put a php.ini file into the directory you wish to change settigns for, only putting in the elements that you need to change. Also if changing the max upload size, change the max post size as well.
 
0
•••
You can typically put a php.ini file into the directory you wish to change settigns for, only putting in the elements that you need to change. Also if changing the max upload size, change the max post size as well.
Typically, you can only do this if PHP is run as CGI/FastCGI, not mod_php - if the setting you're trying to change is PHP_INI_PERDIR/PHP_INI_ALL (and SAPI = mod_php) then you can use .htaccess.
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back