How to cap size of all uploads for entire site (not change size file when uploading)?


(Rob) #1

Hello WPChat,
Any idea on how I could limit the maximum size of uploads for entire WP installation?

I’m not looking for increasing file size per upload. I would like to control the total size all users can upload. Not limit per user but for entire site. I would like to create different membership levels and each levels gets an increased amount of space on the site.

For example:

  • level 1 = 10MB
  • level 2 = 50MB
  • level 3 = 100MB

Any idea on how to achieve this?


(Leland Fiegel) #2

Have you inquired to see if Pro Sites can do this? If not, that would be where I would start.

It says “control upload space” is one of the features but doesn’t elaborate on if it can do what you describe.


(Rob) #3

Yes, Pro Sites can actually do this but it’s designed and works with multisites.
This inquiery is for single WP installations.


(Leland Fiegel) #4

I’m not quite following. You said “not limit per user but for entire site” and then “create different membership levels and each levels gets an increased amount of space on the site”

Are the users not associated with membership levels?


(Rob) #5

Yeah I see what you mean. More details from my end would be helpful…

So someone would sign up and pay for a site on my main site, then I would create a site for them, and implement some sort of max site upload cap at the same time. Then I hand over the site to them with this cap. If they go to the main site and adjust their membership level I would go in and manually adjust their upload limit.

Once that person/admin has their site they can add users as they see fit, but the entire site and all the users would be bound by this upload limit.


#6

It’s ironic you aren’t using multisite, as that is a built-in feature.

If I were doing it with single sites, I would handle this at the filesystem. Since it is manual, you can just provision the disk space as needed.


(Jeffrey Carandang) #8

On this approach of mine : https://phpbits.net/wordpress-replace-user-uploaded-large-images-automatically/ to resize user upload images, you can actually do the user limit on this filter too. Just save the file size on options table and add every user uploads until it reaches the limit. Not sure how you can serve notification on the user when the limit was reached but you can probably do email notification or save another option. I hope this will be of great help. Thanks!


(Rob) #9

@phpbits this is a little bit beyond my skills but will save this for when I’m ready to hire a developer for the more advanced stuff. Thanks for the idea!


(Jeffrey Carandang) #10

No problem :slight_smile: Really happy to help!

Cheers,
Jeffrey