PHP disk_free_space() Function

In the disk_free_space() function is used to gives how much free space available in specified disk(directory). Which function is returns two out puts that are TRUE and FALSE.

Demo :



Type Directory Name :  
       

Example :

In the above demo just you enter directory name at text box and then click check button now will be displayed disk free space for example type at text box /tmp directory name and click check button now will be displayed free space. If you use this script windows operating system type c: or d: at text box and check button click , now will be displayed free space.

Code :

Following code is use to disk_free_space function if you need code to copy and use to your website.


<?php
  $dir ="c:";
  $free = round(disk_free_space($dir)/1048576);
  echo " $free MB free";
?>

In the above example $dir variables is used to assign drive name (directory name) and $free variable is used to calculate and assign to disk free space.finally from $free variables print the outputs.

Free Download Script :

If you need to disk free space function code click and download from following link.

Download




Content