WordPress: Maximum upload file size

There will be times when you want to upload a file larger than the default allowed size within WordPress. There are one or two settings that you will need to change within your php.ini file.

My php.ini file location (yours may vary)

  • /etc/php.ini

Settings that you will need to change:
Note: you will only need to change the upload_max_filesize number if you want an upload size smaller than 8M (or smaller than your post_max_size).

  • upload_max_filesize = 2M
  • post_max_size = 8M

As you can see, my max upload file size is 2M and my max post size is 8M. I was more concerned about my max upload size, but I have to take the post size into consideration if I want to make the max upload size larger than the max post size (did you get all that?).

In short, I can not make my max upload size larger than the max post size. If I do, the max upload size will default to the max post size (I know, my head hurts too).

Go ahead and vi (you will need to be root/use sudo) your php.ini file and edit upload_max_filesize and post_max_size.

I changed my settings to the following as an example

  • upload_max_filesize = 200M
  • post_max_size = 200M

Here is the result

You will need to restart apache to apply your new settings.

Note: the only issue that I am seeing so far is that changing the php.ini file is a global change. I am hosting multiple websites, and I do not want to give these privileges to all website owners. This problem will have to wait to be solved another day.


By Tommy Elmesewdy

DevOps Engineer