21282 Posts in 5730 Topics by 2601 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 158 Views |
-
SS 3. Limit on the total size of the user downloaded files

14 September 2012 at 8:31pm
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)?
| 158 Views | ||
|
Page:
1
|
Go to Top |
