How To Limit Media Upload Size In WordPress

About The Author
Cabe Nolan is the founder of WP Cover where he shares his insight into WordPress, development, & entrepreneurship. Outside of WPCover, Cabe continues to run a successful WordPress development firm, Bold City Design as well as a few high profile websites, Arrivala, Two Way Resume, Dock Skipper, and a successful outdoors brand, DolfinPack.

How To Limit Media Upload Size In WordPress

I have a client who runs several magazines with accompanying online blogs.  They put out ALOT of content and ALOT of pictures.  The client understands the important concept of downsizing photos for web to help with load time, SEO, site performance, etc. and she has worked very hard to convey these concepts to her employees but some things just don’t stick.

Fast forward and the blogs are quickly approaching 70GB in disk space, primarily due to the 1-2MB photos that are uploaded on a somewhat regular basis.  We rely heavily on image thumbnails to crank down the photo sizes but that can only do so much.  Looking for more solutions, I turned to the PHP server configuration to downsize and limit the maximum file upload size and it was very easy to implement.  To complete this task, I simply jumped into the .htaccess file and added the following line to the very top of the file:

php_value upload_max_filesize 1M

Just like that, now on our main media upload screen with have a maximum upload file size defined of 1MB:

Screen Shot 2016-06-08 at 8.16.50 AM


Just as a quick update, we went back in and modified this particular site down to 500KB to ensure files stayed even smaller.  As you would probably expect, the .htaccess line item to achieve this would be:

php_value upload_max_filesize 500K

I will also be implementing WPMU Dev’s Smush Pro Plugin over the next day or two. I will be back with a review and update as we try to smush five years worth of 2MB images.

**Update – the WPMU Dev Smush Pro Plugin has now been added to the WP Cover plugin write-ups.  View more info on it: WP Smush Pro By WPMU Dev


Share Your Thoughts

Leave a Reply

Your email address will not be published.

Related Stuff You Might Like

WordPress News, Tips, & Code Snippets

Join the WP Cover mailing list and get wordpress news, tips, code snippets, security warnings, and more delivered right to your inbox.  We won't flood your inbox, newsletters typically go out every 1-2 weeks unless it involves an important security release.

You have Successfully Subscribed!