I wrote a file uploader but to tell users how much space is left in the server I needed to add a bit of code.
After some reading I found out about disk_total_space($dir) and disk_free_space($dir).
The code I've written is:
$dir = "/";
$total = disk_total_space($dir);
echo "Total availble space: ".round(($total/ (102410241024)),0)."Mb<br>";
$free = disk_free_space($dir);
echo "Total free space: ".round(($free / (102410241024)),0)."Mb<br>";
$totalsite = $total - $free;
echo "Total used space: ".round(($totalsite/ (102410241024)),0)."Mb<br>";
$file_size = $totalsite / (102410241024);
output is:
Total availeble space: 71Mb
Total free space: 58Mb
Total used space: 14Mb
The problem is that availeble space should be 100Mb and Free space should be 85.6Mb and used 14.4MB