PHP Classes

File: examples_file.php

Recommend this page to a friend!
  Classes of Sven Wagener   File class   examples_file.php   Download  
File: examples_file.php
Role: Example script
Content type: text/plain
Description: Example script for file class
Class: File class
File manipulation and form upload handling
Author: By
Last change: Corrected variable name
Date: 20 years ago
Size: 1,115 bytes
 

Contents

Class file image Download
<?
/********************************************
*
* 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();

?>