Home > Tips & Tricks > Increase Maximum PHP File Upload Size

Increase Maximum PHP File Upload Size

In this trick, we will see how we can increase the maximum file upload size in PHP. The default PHP values for upload_max_filesize is 2 MB and for post_max_size is 8 MB.

There are many shared hosts that have restrictions on the file upload size and you cannot alter it and it only allows you to upload files whose size is not more than their limit.

But there are also many hosts which allow you to change the default configuration of PHP by creating your own php.ini file. In this file, you can increase the file upload size and post max size or many other default variables in PHP.

So simply create a php.ini file in the public_html directory of your site if there is not one by default. Follow the steps to increase the maximum limit of file upload size in the PHP configuration file.

  1. Open the php.ini file in your editor.
  2. Search for “upload_max_filesize” variable and change its limit.
  3. Search the “post_max_size” variable and change its limit.
  4. Save the file and restart your server.

You can change the limit as per your requirements.

Being Tricky 😉

Photo of author

About Aman Mehra

Hey there! I'm Aman Mehra, a full-stack developer with over six years of hands-on experience in the industry. I've dedicated myself to mastering the ins and outs of PHP, WordPress, ReactJS, NodeJS, and AWS, so you can trust me to handle your web development needs with expertise and finesse. In 2021, I decided to share my knowledge and insights with the world by starting this blog. It's been an incredible journey so far, and I've had the opportunity to learn and grow alongside my readers. Whether you're a seasoned developer or just dipping your toes into the world of web development, I'm here to provide valuable content and solutions to help you succeed. So, stick around, explore the blog, and feel free to reach out if you have any questions or suggestions. Together, let's navigate the exciting world of web development!

Leave a Comment