Location: PHPKode > scripts > File class > file-class-1403/examples_file.php
<?
/********************************************
*
*   Examples for file handling class
*
*/

include("file.class.php"); // Including file class

// $file=new file("test.swf",true); // Creating an instace of class for binary files
$file=new file("test.txt"); // Creating an instace of class

/***
* Debug mode:
*
* If debug mode is switched on, the script will stop at each error and the error will be printed out to screen
*/
$file->debug_mode(); // Switching on debug mode


// Geting file pointer and printing out
echo $file->pointer_get();

// Setting file pointer to 5
$file->pointer_set(5);

// Writing data to file on actual pointer position
$file->write("my text");

// Copying file
echo $file->copy("test.txt");

// Getting file name and printing out
echo $file->get_name();

// Getting file size and printing out
echo $file->get_size();

// Getting owner id of file and printing out
echo $file->get_owner_id();

// Getting group id of file and printing out
echo $file->get_group_id();

// Getting suffix of file and printing out
echo $file->get_suffix();

?>
Return current item: File class