This topic is locked
[SOLVED]

 Total file upload size per user

3/6/2018 9:24:50 PM
PHPRunner General questions
H
headingwest author

Hi,
Say I want each user to be limited to 50MB of files. Is there any way to save the file sizes as they are uploaded. I know that the file size appears next to the file when you save/edit them.
Thanks for your help.

H
headingwest author 3/7/2018

I used this function:
https://gist.github.com/eusonlito/5099936



<?php

function folderSize ($dir)

{

$size = 0;

foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {

$size += is_file($each) ? filesize($each) : folderSize($each);

}

return $size;

}