Home >Backend Development >PHP Tutorial >Why Doesn't My PHP `ini_set('upload_max_filesize')` Work as Expected?
Troubleshooting upload_max_filesize Modification in PHP
When encountering inconsistencies between the intended and observed values of upload_max_filesize, it's crucial to investigate potential causes. Here's a closer examination of the issue:
Original Code and Behavior:
<?php ini_set('upload_max_filesize', '10M'); echo ini_get('upload_max_filesize'), ", ", ini_get('post_max_size'); ?>
Upon execution, this code outputs "2M, 8M" despite the php.ini settings being:
upload_max_filesize = 10M post_max_size = 10M
Potential Causes:
Solution:
Once these corrections are made, the code should reflect the expected behavior and allow for file uploads up to the specified limit.
The above is the detailed content of Why Doesn't My PHP `ini_set('upload_max_filesize')` Work as Expected?. For more information, please follow other related articles on the PHP Chinese website!