File: examples_uploaded_file.php

Recommend this page to a friend!
  Classes of Sven Wagener  >  File class  >  examples_uploaded_file.php  >  Download  
File: examples_uploaded_file.php
Role: Example script
Content type: text/plain
Description: Examples for uploaded file handling class
Class: File class
File manipulation and form upload handling
Author: By
Last change: Added examples for new file reading functions
Date: 16 years ago
Size: 1,325 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("dertest01\r\n");

// Getting data from line to line
while($line=$file->read_line()){
    echo
$line."\n";
}

// Getting data in an exact position
echo $file->read_bytes(5,0);

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

// Getting file name and printing out
echo $file->get_name()."\n";

// Getting file size and printing out
echo $file->get_size()."\n";

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

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

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

?>


For more information send a message to info at phpclasses dot org.