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 Simplest Way to Use Roles and Permission in Laravel

Simplest Way to Use Roles and Permission in Laravel

August 23, 2022March 16, 2024

Roles and permission in laravel are used to provide roles based authentication and in this post we will learn simplest wat to use roles and permission in laravel. In our application we want features and modules on basis of roles or permissions so that we can restrict users to access…

Read More
Php Laravel Auto Load Infinite Scroll pagination with search

Laravel Auto Load Infinite Scroll pagination with search

May 8, 2022May 8, 2022

In this tutorial we will learn Auto Load Infinite Scroll pagination with search in Laravel using Ajax jQuery. Laravel provides its own library to build the pagination html, which we can easily use in our html page using $model->links() method and $model->paginate() method to make a long list into pagination.In…

Read More
Php How to fetch Soft Deleted Records in Laravel 9

How to Fetch Soft Deleted Records in Laravel ?

June 17, 2022June 21, 2022

In this article we will learn to fetch soft deleted records in Laravel. In our recent article Use Soft Delete to Temporary (Trash) Delete the Records in Laravel ? we learnt to delete the file without actually deleting from database and sometimes we want to show records that are soft…

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

  • Installing a LAMP Stack on Ubuntu: A Comprehensive Guide
  • Understanding High Vulnerabilities: A Deep Dive into Recent Security Concerns
  • Understanding High Vulnerabilities in Software: A Week of Insights
  • Blocking Spam Requests with LaraGuard IP: A Comprehensive Guide
  • Enhancing API Development with Laravel API Kit
©2023 Readerstacks | Design and Developed by Readerstacks
Go to mobile version