Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » SS 3. Limit on the total size of the user downloaded files

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 368 Views
  • Spihex
    Community Member
    5 Posts

    SS 3. Limit on the total size of the user downloaded files Link to this post

    There was a need to display the size of the downloaded user file, and I have decided it is simple:

    SomeFunction {
    $userID = Member :: currentUserID ();
    return File :: get () -> filter (array ("OwnerID" => "$userID"));

    and in the template as follows:

    <% Control SomeFunction%>
    File Name: $Name | File Size: $Size
    <% end_control%>

    And there were no questions.

    But there is another need - to prevent a user to download a file, if it has already reached the limit on the total size of all files, for example, the limit of N mb. I read the manual, but did not understand what to do. If the table "File", it would be a field "Size", I think I would have found the answer, but it is not there Should I use $Size somewhere inside SomeFunction? Tell me, please, what to do?
    Can I do without creating an extra class File (for example, UserFiles extend File)?

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.