Limit folder (with subfolders) capacity

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • freduchi@gmail.com

    Limit folder (with subfolders) capacity

    Hi, I need sugestions.
    I need to implement the next and I don´t know how to do it:

    I am developing a website in which users are signed up and share
    information(Mes sages, Photos...).

    When a user is signed up, his data is stored in a database and he is
    asigned with a folder.

    What I need, is to limit the folder capacity of each user to a given
    size(5 mb for example).

    For now all users would have the same capacity.And that would be
    enough for now.

    I Can´t limit this by code, because I am using third party software,
    in some services, and I cannot control It.

    I have read about something disk quotas.I am not
    familiar to this.Would it be useful for my needs?.

    If not, Which is the best way to achieve this?.

    The ideal for me would be to be able to limit the capacity of a given
    folder(included subfolders) to a size, so when I create the folder in
    my code, I would also limit its size to the desired capacity.

    Note: I am using php5 and my hosting uses linux.

    Thanks.
    Sincerely - SPEASEMAR - Spain


  • Jerry Stuckle

    #2
    Re: Limit folder (with subfolders) capacity

    freduchi@gmail. com wrote:
    Hi, I need sugestions.
    I need to implement the next and I don´t know how to do it:
    >
    I am developing a website in which users are signed up and share
    information(Mes sages, Photos...).
    >
    When a user is signed up, his data is stored in a database and he is
    asigned with a folder.
    >
    What I need, is to limit the folder capacity of each user to a given
    size(5 mb for example).
    >
    For now all users would have the same capacity.And that would be
    enough for now.
    >
    I Can´t limit this by code, because I am using third party software,
    in some services, and I cannot control It.
    >
    I have read about something disk quotas.I am not
    familiar to this.Would it be useful for my needs?.
    >
    If not, Which is the best way to achieve this?.
    >
    The ideal for me would be to be able to limit the capacity of a given
    folder(included subfolders) to a size, so when I create the folder in
    my code, I would also limit its size to the desired capacity.
    >
    Note: I am using php5 and my hosting uses linux.
    >
    Thanks.
    Sincerely - SPEASEMAR - Spain

    >

    Disk quotas are a function of the operating system, not PHP. They will
    do what you want, but how to set them is OS dependent (and you may not
    be able to do it in your code due to OS or hosting company restrictions).

    What I do is when they go to the upload page, I check how much space
    they have left in the directory, then set that as the maximum they can
    upload.

    Of course this won't work if they use ftp or similar, but it works fine
    for uploading via html pages.


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Alvaro G. Vicario

      #3
      Re: Limit folder (with subfolders) capacity

      *** freduchi@gmail. com escribió/wrote (24 Aug 2006 12:47:28 -0700):
      I have read about something disk quotas.I am not
      familiar to this.Would it be useful for my needs?.
      I don't think so. Disk quotas allow you to limit the number/size of files a
      user can save in a disk partition. But PHP scripts run with the same system
      user, no matter who's logged in your app.
      If not, Which is the best way to achieve this?.
      If I understood correctly, you don't have any control over the database or
      the software that creates the files. So you need a solution that makes the
      software just fail when over quota... :-?

      I can't figure out how to do that. You can always remove images after being
      uploaded but that'd be a big mess.

      Maybe if you describe how that third party software works we can think of a
      sensible solution...

      --
      -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
      ++ Mi sitio sobre programación web: http://bits.demogracia.com
      +- Mi web de humor con rayos UVA: http://www.demogracia.com
      --

      Comment

      • freduchi@gmail.com

        #4
        Re: Limit folder (with subfolders) capacity

        Well, I am giving the users the possibility to upload files by two
        ways.

        In the first way (photo upload) I have the control over the code (I
        have written it) and is easy to control the number and size of files
        uploaded.

        In the second way It is more difficult because I am using a third party
        software.This sotware is a wysiwyg with file upload posibility.It is
        called fckeditor.I am using it in several services(messag es between
        users, comments about users, blogs... ).This sofware gives you a very
        nice wysiwyg interface(with upload interface included) and returns the
        result as html code in a html text_area.I insert this html code in a
        database.

        I have "semisolved " the problem.
        I have had to rewrite some code of fckeditor.

        It hasn´t been very difficult but doing all this by code isn´t a very
        flexible solution.

        Isn´t There a way to lock a folder to a maximum size.
        Of course I assume the solution (if exists) will be platform dependant;

        Thanks.
        Sincerely - SPEASEMAR - Spain


        Alvaro G. Vicario ha escrito:
        *** freduchi@gmail. com escribió/wrote (24 Aug 2006 12:47:28 -0700):
        I have read about something disk quotas.I am not
        familiar to this.Would it be useful for my needs?.
        >
        I don't think so. Disk quotas allow you to limit the number/size of filesa
        user can save in a disk partition. But PHP scripts run with the same system
        user, no matter who's logged in your app.
        >
        If not, Which is the best way to achieve this?.
        >
        If I understood correctly, you don't have any control over the database or
        the software that creates the files. So you need a solution that makes the
        software just fail when over quota... :-?
        >
        I can't figure out how to do that. You can always remove images after being
        uploaded but that'd be a big mess.
        >
        Maybe if you describe how that third party software works we can think ofa
        sensible solution...
        >
        --
        -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
        ++ Mi sitio sobre programación web: http://bits.demogracia.com
        +- Mi web de humor con rayos UVA: http://www.demogracia.com
        --

        Comment

        • Jerry Stuckle

          #5
          Re: Limit folder (with subfolders) capacity

          Alvaro G. Vicario wrote:
          *** freduchi@gmail. com escribió/wrote (24 Aug 2006 12:47:28 -0700):
          >
          >>I have read about something disk quotas.I am not
          >>familiar to this.Would it be useful for my needs?.
          >
          >
          I don't think so. Disk quotas allow you to limit the number/size of files a
          user can save in a disk partition. But PHP scripts run with the same system
          user, no matter who's logged in your app.
          >
          Actually, you can. You can limit the size of the directory in either
          Linux or Windows Server. Any attempt to store more than that in the
          directory will return an error.
          >
          >>If not, Which is the best way to achieve this?.
          >
          >
          If I understood correctly, you don't have any control over the database or
          the software that creates the files. So you need a solution that makes the
          software just fail when over quota... :-?
          >
          I can't figure out how to do that. You can always remove images after being
          uploaded but that'd be a big mess.
          >
          Maybe if you describe how that third party software works we can think of a
          sensible solution...
          >

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Alvaro G. Vicario

            #6
            Re: Limit folder (with subfolders) capacity

            *** Jerry Stuckle escribió/wrote (Thu, 24 Aug 2006 21:06:41 -0400):
            >I don't think so. Disk quotas allow you to limit the number/size of files a
            >user can save in a disk partition. But PHP scripts run with the same system
            >user, no matter who's logged in your app.
            >>
            >
            Actually, you can. You can limit the size of the directory in either
            Linux or Windows Server. Any attempt to store more than that in the
            directory will return an error.
            He needs to set limits in a per-user base. His web app will always run
            under the *same* user: nobody, apache, LOCAL SYSTEM or whatever. And to
            make it worse, quotas work over system users. The users that register in
            your web site do not count for the OS.


            --
            -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
            ++ Mi sitio sobre programación web: http://bits.demogracia.com
            +- Mi web de humor con rayos UVA: http://www.demogracia.com
            --

            Comment

            • Alvaro G. Vicario

              #7
              Re: Limit folder (with subfolders) capacity

              *** freduchi@gmail. com escribió/wrote (24 Aug 2006 15:58:07 -0700):
              In the second way It is more difficult because I am using a third party
              software.This sotware is a wysiwyg with file upload posibility.It is
              called fckeditor.I am using it in several services(messag es between
              users, comments about users, blogs... ).This sofware gives you a very
              nice wysiwyg interface(with upload interface included) and returns the
              result as html code in a html text_area.I insert this html code in a
              database.
              >
              I have "semisolved " the problem.
              I have had to rewrite some code of fckeditor.
              >
              It hasn´t been very difficult but doing all this by code isn´t a very
              flexible solution.
              I've had a very quick look at FCKeditor's code. Unluckily, it isn't object
              oriented so you can't write a child class that inherits from the original
              one, so you can keep in untouched. But the code itself is very simple
              (after all, the project is basically a JavaScript tool) so I believe you've
              chosen a good solution. Just keep track of your changes in case you even
              want to upgrade. Or, if your code is good, you can even submit it to the
              authors ;-)



              --
              -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
              ++ Mi sitio sobre programación web: http://bits.demogracia.com
              +- Mi web de humor con rayos UVA: http://www.demogracia.com
              --

              Comment

              • Jerry Stuckle

                #8
                Re: Limit folder (with subfolders) capacity

                Alvaro G. Vicario wrote:
                *** Jerry Stuckle escribió/wrote (Thu, 24 Aug 2006 21:06:41 -0400):
                >
                >>>I don't think so. Disk quotas allow you to limit the number/size of files a
                >>>user can save in a disk partition. But PHP scripts run with the same system
                >>>user, no matter who's logged in your app.
                >>>
                >>
                >>Actually, you can. You can limit the size of the directory in either
                >>Linux or Windows Server. Any attempt to store more than that in the
                >>directory will return an error.
                >
                >
                He needs to set limits in a per-user base. His web app will always run
                under the *same* user: nobody, apache, LOCAL SYSTEM or whatever. And to
                make it worse, quotas work over system users. The users that register in
                your web site do not count for the OS.
                >
                >
                True. But each user is assigned their own directory, and he can limit
                the amount of space used by that directory.

                See the original posting.


                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Alvaro G. Vicario

                  #9
                  Re: Limit folder (with subfolders) capacity

                  *** Jerry Stuckle escribió/wrote (Fri, 25 Aug 2006 14:12:55 -0400):
                  >He needs to set limits in a per-user base. His web app will always run
                  >under the *same* user: nobody, apache, LOCAL SYSTEM or whatever. And to
                  >make it worse, quotas work over system users. The users that register in
                  >your web site do not count for the OS.
                  >
                  True. But each user is assigned their own directory, and he can limit
                  the amount of space used by that directory.
                  >
                  See the original posting.
                  How can you do so if you don't put each directory in a separate partition?

                  --
                  -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
                  ++ Mi sitio sobre programación web: http://bits.demogracia.com
                  +- Mi web de humor con rayos UVA: http://www.demogracia.com
                  --

                  Comment

                  • Jerry Stuckle

                    #10
                    Re: Limit folder (with subfolders) capacity

                    Alvaro G. Vicario wrote:
                    *** Jerry Stuckle escribió/wrote (Fri, 25 Aug 2006 14:12:55 -0400):
                    >
                    >>>He needs to set limits in a per-user base. His web app will always run
                    >>>under the *same* user: nobody, apache, LOCAL SYSTEM or whatever. And to
                    >>>make it worse, quotas work over system users. The users that register in
                    >>>your web site do not count for the OS.
                    >>
                    >>True. But each user is assigned their own directory, and he can limit
                    >>the amount of space used by that directory.
                    >>
                    >>See the original posting.
                    >
                    >
                    How can you do so if you don't put each directory in a separate partition?
                    >
                    By using the OS tools. Both Linux and Windows 2003 Server allow you to
                    limit the amount of disk space used by a single directory.

                    See your system administrator for more information or check an OS
                    related newsgroup.

                    --
                    =============== ===
                    Remove the "x" from my email address
                    Jerry Stuckle
                    JDS Computer Training Corp.
                    jstucklex@attgl obal.net
                    =============== ===

                    Comment

                    Working...