Increase Max Upload File Size in WordPress
by c.bavota | Posted in Tutorials | 22 comments
Jan
17
2012
Sometimes, you need to upload a large file to your site, and the default 8mb limit in WordPress isn’t enough. I attempted to change my limit directly on my server, then in the .htaccess file and then in wp-config.php but neither change worked for me. Then I came across this little snippet by Word Impressed which actually worked and allowed me to increase my max upload file size limit.
All you need to do is create a php.ini file and upload it into your /wp-admin folder. Then add the following:
memory_limit = 32M upload_max_filesize = 32M post_max_size = 32M file_uploads = On
You can change 32m to whatever max file size you want.



Just a note here,
The limit isn’t imposed by WordPress, and there isn’t a 8mb default from WordPress either. It’s completely up to the server to set the limit if any. In some cases the wp-config.php trick to increase it will work, in others the htaccess will, and in others the php.ini as you suggested will. It depends entirely on the server’s configuration and not on WordPress. So results will vary for everyone.
Thanks for the clarification.
I agree, Joachim. Placing a php.ini file with the above code in my /wp-admin folder didn’t have any affect. The htaccess file was my solution… and even then, I had to get my host to do some correcting on the server for this to work.
This had been annoying me for a while and the php.ini trick worked for me. Thanks a lot!
Thanks. I also have been banging my head against the wall trying to figure this out.
It’s defiantly worth mentioning that many hosts wont allow you to create a php.ini file if your a shared hosting. Also I’m not sure I like the idea of people being able to upload more than 8 meg. I personally cant see any genuine reason as it will only cause issues to end users.
I needed to do this so a client could upload large PDF files but it isn’t a change that most people would want to do.
My clients needed to upload their software to their site and it was well over 8mb.
This was very helpful, thanks c
The upload limit is set by PHP on your server to a default 8Mb. Take to code snippit above and create a text file “php.txt”. Once the file is made, change the ‘txt’ extension to ‘ini’, and uplod it to the root directory on your server – nowhere else is necessary. Many servers do not have a php.ini file in the root already, so don’t worry if you do not see one there at first. What happens, is that every time you access a PHP function, like uploading a file, PHO looks to the root directory to see if it’s defaults have been modified. If PHP sees nothing, then it runs with it’s default parameters. If it sees ‘php.ini’, it conforms to the code found there, and runs accordingly. Additionally, if your server is running php5.x.x, as many are doing nowadays, you will have to name your ‘.ini” file to ‘php5.ini’. Thank me for this, because I have never found any documentation explaining this. And you don’t have to use ‘php5.x.x.ini’, ‘php5.ini’ will work just fine. BTW, why don’t you just set the upload_max_filesize to 192Mb, while you’re at it. Same for memory, same for post. Good luck.
I host my site on a Cloud Server, when doing the mentioned it had no effect, I had to edit the main php.ini in the apache2 folder.
But thanks for the settings, was just a mere copy and paste
Most Shared Hosters won’t allow their customers to change this setting. If you care about your RAM you should not set this value to high. PHP was not meant to replace FTP
thansk ! i get error when upload a video for advertizing !
This article and the subsequent discussion helped clarify the issue of uploading large files. Thanks to all who contributed.
Dude!!! You are a GENIUS!!! I read about 50+ blog entries, including wordpress.org itself. I tried all the htaccess, wp-congig.php, etc., etc., etc. I’m hosted by 1and1, and your advice worked perfectly, where none of the others did. FYI: 1and1 business has an 80mb memory limit right out of the gate.
Thank You! Thank You! Thank You! Thank You!
I work with a lot of large image files(infographics, decision tables, etc), so being able to increase file size would be such a blessing.
I’m really excited to give this a shot. I just hope I don’t have to change servers in order to make this work. I will have to test the compatibility of the htaccess file with the parameters set forth by the server. Fingers crossed….
Thanks for the feedback about the hidden fields, it’s certainly something we will be looking at as part of the next set of enhancements
Nice advice 10x.
it’s Good for me ! i am designing a shopping web, all the picture upload is so big so this is the solution for me !
Thanks you very much. It’s very usefull
Thanks you, Good
very useful for me and Thank !