PHP Classes

File: size.class_example.php

Recommend this page to a friend!
  Classes of Enéas Gesing   Size   size.class_example.php   Download  
File: size.class_example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Size
Retrieve the available space in a disk partition
Author: By
Last change:
Date: 19 years ago
Size: 969 bytes
 

Contents

Class file image Download
<?php

//call class file
require_once 'size.class.php';

//path to get information
$path = "/path/to/get/size";

//object builder
$size = new size($path);

/*for windos drives use (depends of your drives configuration)
$path = "C:"; for hard disk
$path = "D:"; for compact disk
*/

//total size in bytes
echo "<br>";
echo
"Total Size: ";
echo
$size->total_size($path);
echo
" bytes";

//free space in bytes
echo "<br>";
echo
"Free Space: ";
echo
$size->free_space($path);
echo
" bytes";

//used space in bytes
echo "<br>";
echo
"Used Space: ";
echo
$size->used_space($path);
echo
" bytes";

//total size in MB
echo "<br>";
echo
"Total Size: ";
echo (
$size->total_size($path))/1048576;
echo
" MB";

//free space in MB
echo "<br>";
echo
"Free Space: ";
echo (
$size->free_space($path))/1048576;
echo
" MB";

//used space in MB
echo "<br>";
echo
"Used Space: ";
echo (
$size->used_space($path))/1048576;
echo
" MB";

?>