Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 653107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:20:44+00:00 2026-05-13T22:20:44+00:00

Let say, I have a web application that allows users to upload images and

  • 0

Let say, I have a web application that allows users to upload images and documents and my application stores all those assets on S3, is there a way I can monitor resource usage PER user account?

For example, if a user account has a 1GB storage limit, how can I monitor how much of that allowance any individual is using?

Furthermore (but this is less of an issue to me) if that user account also has a 5GB bandwidth limit, are there any tools available that allow me to monitor just their S3 bandwidth?

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:20:44+00:00Added an answer on May 13, 2026 at 10:20 pm

    Yes, this is possible. You can use papreclip to manage file uploads (or any other reputable upload management plugin/gem). Most of these tools give you access to the filesize of the uploaded file. You can simply store these files in the database along with the asset_uri (which I imagine you’re already storing), and to check if a user can upload another file, simply sum all the sizes of all assets with the appropriate user_id.

    Users:
      id
      email_address
      first_name
      upload_limit
    
    Assets:
      id
      user_id
      uri
      filesize
      filename
    

    Then, to grab the total size of uploaded files by a particular user, you could do:

    class User < ActiveRecord::Base
      has_many :assets
    
      #Check if the user can upload another file
      def can_upload?
        if Asset.sum('filesize', :conditions => 'user_id = #{self.id}') >= self.upload_limit
          return false
        else
          return true
        end
      end
    
      #See the user's used storage space
      def used_storage
        return Asset.sum('filesize', :conditions => 'user_id = #{self.id}')
      end
    
      #See how much space the user has remaining
      def available_storage
        if self.can_upload?
          return self.upload_limit - Asset.sum('filesize', :conditions => 'user_id = #{self.id}')
        else
          return 0
        end
      end
    end
    

    You can see I’m making use of the ActiveRecord sum function here to do the calculation. You could just as easily use a map or some other ruby based solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have a grails web application exposing several resources. tags urls users
I'm new to Flex. Let's say we have a web application that needs to
Let's say you have a web application that manages books for book sellers, and
Let's say that I have my ASP.NET web application in a directory called MyApp
Let's say I have a Tomcat and a web application on it with index.html
I have a web application containing two web services, let's say PublicHello.asmx and RestrictedHello.asmx
In our web application, we have multiple small applications availables. Let us say A,B,C.
Let's say that I have something like this in my web.xml file. <filter name=foo>
Let's say I have an application that is guaranteed to overwhelm one server even
Let's say I have an web CMS type application, and an EDM model with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.