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 How to convert html to pdf in laravel 8 9

How to convert html to pdf in laravel 8 / 9?

May 5, 2022November 6, 2023

Dompdf package has rich features to convert html to PDF in laravel. In this article we will learn to use html to PDF using dompdf package. In most of the website there is need of to convert html to PDF or export the data in PDF format, Dompdf does this…

Read More
Php How to Filter Data Using Relational Model in Laravel

How to Filter Data Using Relational Model in Laravel ?

June 29, 2022July 1, 2022

In this article i will show you to filter data using the relational model in laravel. Using the laravel relationship between the models we can easily fetch relative data but sometimes we want to fetch the data by filtering the child model that affect the result of parent model. You…

Read More
Php How to add column in laravel migration

How to Add Column in Existing Table Laravel migration ?

February 15, 2022June 30, 2022

Adding column to existing table are easy as creating a new table and adding columns to it. In laravel migration we can add new colum to existing table using the same method we used in create migrations . Major difference between creating new table and updating new table is Schema::create…

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

  • 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

  • The Resilience of Nature: How Forests Recover After Fires
  • Understanding Laravel Cookie Consent for GDPR Compliance
  • Understanding High Vulnerabilities: A Critical Overview of the Week of May 12, 2025
  • Installing a LAMP Stack on Ubuntu: A Comprehensive Guide
  • Understanding High Vulnerabilities: A Deep Dive into Recent Security Concerns
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version