I have a client who wants to be able to upload either one 30MB image, or several smaller images, which in total amounts to 30MB. Is there a way to solve this for Contact Form 7 or any other forms plugin?

This is a duplicate of Upload files - total size limit - Wordpress/Contact Form 7

The user there solved it. but didn't share how, and I don't have enough reputation to comment on the question to ask how he solved it... So I'll just have to ask again

Any help is appreciated.


The user of the other question mentions .user.ini file, which is the equivalent for PHP of what .htaccess is for Apache, namely a local configuration file.

You are looking for limiting the maximum size of a POST request, which is the standard type of requests for sending forms/uploading stuff. The php setting you are looking for, is post_max_size.

Create a .user.ini in the root of your domain (the one with the wp-config.php file) and put just this line inside:

post_max_size = 30M

This will make the php script reject any submission which is larger than 30M, also counting text fields and everything. However depending on your upload logic (ajax? direct post?) you have to handle the "upload too large" case. If you are doing a "simple" form submission you will get a 413 Request entity too large HTTP error. In this case you should consider doing a little apache+htaccess magic and create some customized error pages. If you upload through an ajax submission then you have just to put a simple check in the ajax callback.

Also, you should really put a client-side check before letting the submission: imagine the look on the face of a user that waited whole minutes for a 32M file to upload, only to get an error page in return. Look at this question to learn how to do a client-size check in javascript.


If you are using nginx and/or php-fpm above instructions vary slightly, but it's pretty easy to find the nginx-equivalent settings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.