Skip to content
Readerstacks logo Readerstacks
  • Home
  • Softwares
  • Angular
  • Php
  • Laravel
  • Flutter
Readerstacks logo
Readerstacks

How to increase maximum file upload size in php ?

Aman Jain, August 24, 2021August 24, 2021

Php is the most used language in web. sometimes it required to upload the files which is greater then 2 mb.

In php default upload size is 2 mb and if we wanted to increase it then we have multiple ways to change the size of uploading.

1. Change from php.ini file

php.ini is main configuration file in php where all settings of php are defined. This type of configuration mainly used on localhost or dedicated server where we can access file system using ssh terminal.

Steps to change the upload size

  1. Locate/Find the php.ini file

    Sometimes we install multiple version of php in our system and it will get hard to find the correct file for php.ini. so to find the php.ini we can follow this guideline. Easiest way to find php.ini ?
  2. Edit the file using below command

    Sudo vi path_of_php.ini

    Example:

    php configuration file using phpinfo() in info.php
This image has an empty alt attribute; its file name is Screenshot-2021-08-24-at-8.35.49-AM-1024x586.png


sudo vi /Applications/XAMPP/xamppfiles/etc/php.ini

then search for variable upload_max_size and post_max_size

Screenshot 2021 08 24 at 9.03.23 AM
upload_max_size in php.ini
Screenshot 2021 08 24 at 9.04.03 AM
post_max_size in php.ini

and then restart the apache server

sudo service apache2 restart

2. Create php.ini file in root of project

if you are on shared server then you can create own php.ini file on root of project and add below code

post_max_size=40m
upload_max_size=40m

then save the file

3. Create .htaccess file and set php ini variables

Same as php.ini on root of project we can also add php configuration in htaccess file

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 200
php_value max_input_time 200

then save .htaccess file in root of your project

4. Update from cpanel of website

To edit the configuration from cpanel you can follow this guideline. Easiest way to find php.ini ?

Related

Php

Post navigation

Previous post
Next post

Related Posts

Php Integrate Google Map with Marker in Laravel

Integrate Google Map with Marker in Laravel

August 28, 2022March 16, 2024

In this article we will learn to integrate google map with marker in laravel. Google maps are used to share the location or indicate the location of business and any user. In our application we want to show the exact location so in that case google maps are most optimal…

Read More
Php Multiple Ways to Apply Unique Validation with Soft Delete in Laravel

Multiple Ways to Apply Unique Validation with Soft Delete in Laravel

June 17, 2022June 17, 2022

In this article we will solve the problem of Unique Validation with Soft Delete in Laravel. Soft delete trait in laravel by default add the delete_at null query to all queries but in validation rules of unique it doesn’t apply because validation rule does not use Laravel eloquent model and…

Read More

Create Custom Class or Custom Library in Laravel 10

March 14, 2023March 16, 2024

In Laravel, you can create custom classes or custom library in laravel that can be used throughout your application. These classes can be used to encapsulate common functionality, business logic, or to abstract away complex operations. Thus I this article i will show you to create a class and use…

Read More

Aman Jain
Aman Jain

With years of hands-on experience in the realm of web and mobile development, they have honed their skills in various technologies, including Laravel, PHP CodeIgniter, mobile app development, web app development, Flutter, React, JavaScript, Angular, Devops and so much more. Their proficiency extends to building robust REST APIs, AWS Code scaling, and optimization, ensuring that your applications run seamlessly on the cloud.

Categories

  • Angular
  • CSS
  • Dart
  • Devops
  • Flutter
  • HTML
  • Javascript
  • jQuery
  • Laravel
  • Laravel 10
  • Laravel 11
  • Laravel 9
  • Mysql
  • Php
  • Softwares
  • Ubuntu
  • Uncategorized

Archives

  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • October 2024
  • July 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • July 2023
  • March 2023
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Recent Posts

  • Understanding High Vulnerabilities: A Closer Look at the Week of July 14, 2025
  • Exploring Fresh Resources for Web Designers and Developers
  • The Intersection of Security and Technology: Understanding Vulnerabilities
  • Mapping Together: The Vibrant Spirit of OpenStreetMap Japan
  • Understanding High Vulnerabilities: A Deep Dive into the Weekly Summary
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version