Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php disk_total_space

Tags:

directory

php

i need help with disk_total_space function..

i have this on my code

<?php
          $sql="select * from users order by id";
          $result=mysql_query($sql);
          while($row=mysql_fetch_array($result)) {
?>
Name : <?php echo $row['name']; ?>
Email : <?php echo $row['email']; ?>
Diskspace Available : <?php 
$dir = "C:/xampp/htdocs/freehosting/".$row['name'];
disk_total_space($dir);
} ?>

However this return me same disk space for every users ..

Anyone can shed me some light?

thanks :)


1 Answers

https://www.php.net/disk_total_space says,

"Given a string containing a directory, this function will return the total number of bytes on the corresponding filesystem or disk partition."

You're likely seeing the total_space of C:

Alternative solutions do exist for both Windows and Linux.

like image 50
Sampson Avatar answered Feb 09 '26 08:02

Sampson