Increase PHP’s File Upload Limit Using php.ini

By  on  

The file upload size limit is usually set pretty low by shared hosting providers. Why? To save bandwidth, keep the server moving quickly, and think about it -- how many customers really need a large upload limit? If you do need to increase the maximum upload limit, all you need to do is place the following code snippet in your php.ini file:

file_uploads = On
upload_max_filesize = 10M //needs to be in {x}M format

Note that not all hosting providers allow customers to increase the file upload limit. Take that into consideration when purchasing your customer's web hosting.

Recent Features

  • By
    Chris Coyier’s Favorite CodePen Demos

    David asked me if I'd be up for a guest post picking out some of my favorite Pens from CodePen. A daunting task! There are so many! I managed to pick a few though that have blown me away over the past few months. If you...

  • By
    Designing for Simplicity

    Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...

Incredible Demos

  • By
    Fancy Navigation with MooTools JavaScript

    Navigation menus are traditionally boring, right? Most of the time the navigation menu consists of some imagery with a corresponding mouseover image. Where's the originality? I've created a fancy navigation menu that highlights navigation items and creates a chain effect. The XHTML Just some simple...

  • By
    Create a Download Package Using MooTools Moousture

    Zohaib Sibt-e-Hassan recently released a great mouse gestures library for MooTools called Moousture. Moousture allows you to trigger functionality by moving your mouse in specified custom patterns. Too illustrate Moousture's value, I've created an image download builder using Mooustures and PHP. The XHTML We provide...

Discussion

  1. Thanks, I’m trying to figure out how to make it so music can be played on my blog as soon as others click on. Thanks for the updates.

  2. or just use:

    that will allow uploads and set maximum size to 500mb

  3. Bakiyaraj

    Sorry it is not working… When i changed this, after executing in IE, it throws a javascript error with restriction of 8MB. and in mozilla and chrome, it restricts 2MB file.. help me

  4. Maybe another solution would be with a .htaccess file with something like:

    php_value memory_limit 36M
    php_value post_max_size 36M
    php_value upload_max_filesize 32M

  5. Litos

    Hey Rafael,
    I have no idea how to locate the php.ini file. Is this in my local hard drive? I use a macbook Pro. No luck so far. Can you please help out a noob? thanks in advance :)

  6. Kagan Kayal

    If you increase the upload_max_filesize parameter in php.ini, you have to increase the maximum size of POST data as well. That includes the file upload and other form data. The parameter name is post_max_size.

  7. is there any limit in upload_max_filesize ? i mean 64M or 128M etc

  8. You say php_value memory_limit 36M and post_max_size 36M, it’s ok but upload max filesize 32M. Good I Think It’s Better System.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!