PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Peter Molefe Ramokone   File Handling   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Read me
Class: File Handling
Perform several operations to manipulate files
Author: By
Last change:
Date: 18 years ago
Size: 7,539 bytes
 

Contents

Class file image Download
// -------------------------------------------------------------------------------- // Dozman Library - FileHand Module 1.0 // -------------------------------------------------------------------------------- // License GNU/LGPL - Peter Ramokone - March 2005 // -------------------------------------------------------------------------------- // // FileHand is a PHP library that manage files archives. // // Description : // See readme.txt // // Warning : // This library and the associated files are non commercial. // It should not have unexpected results. However if any damage is caused by // this software the author 'Peter Ramokone' can not be responsible. // The use of this software is at the risk of the user. // // -------------------------------------------------------------------------------- // filehand.doz.php ,v 1.0 2005/03/02 //fileclass.php can be used to upload image and text files with a web /*browser. The uploaded file's name will get cleaned up - special characters will be deleted, and spaces get replaced with underscores, and moved to a specified directory (on your server). fileupload-class.php also does its best to determine the file's type (text, GIF, JPEG, etc). If the user has named the file with the correct extension (.txt, .gif, etc), then the class will use that, but if the user tries to upload an ex tensionless file, PHP does can identify text, gif, jpeg, and png files for you. As a last resort, if there is no specified extension, and PHP can not determine the type, you can set a default extension to be added. --// */ How to use the class -------------------- Uploading a file ------------------ $fhand->uplFs($_FILES['file']['tmp_name'],$_FILES['file']['name'],$_FILES['file']['size'],1024,'gif,jpg,bmp'); Error handling -------------- this function works nice/appropriate when you put it in the if statement. E.G. if($fhand->uplFs($_FILES['file']['tmp_name'],$_FILES['file']['name'],$_FILES['file']['size'],1024,'gif,jpg,bmp')==true) : The first argument is the file in the temporary directory : The second argument is the file name or the file which you saving as : The third argument is the size of the file that is in the temporary directory : The fourth argument is the size limit in bytes (1024 = 1MB) or 0 if there is no limit : The fifth argument is the mime types you want to accept. when you use the if statement, your errors will be posted, and call then as: $fhand->f_err() ************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Renaming a file ------------------ $fhand->reaFs($file_and_destination,$newfile_and_destination); Error handling -------------- this function works nice/appropriate when you put it in the if statement. E.G. if($fhand->reaFs($file_and_destination,$newfile_and_destination)==true) : The first argument is the file and directory if appropriate E.G. ../image.jpg : The second argument is the new file name and directory if appropriate E.G. ../image2.jpg when you use the if statement, your errors will be posted, and call them as: $fhand->f_err() ************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Deleting a file $fhand->delFs($filename); Error handling -------------- this function works nice/appropriate when you put it in the if statement. E.G. if($fhand->delFs($filename)==true) : The argument is the file and directory if appropriate E.G. ../image.jpg or c:\\docs\pics.gif when you use the if statement, your errors will be posted, and call them as: $fhand->f_err() ************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Deleting a file $fhand->movFs($dir_filename,$new_dir_file); Error handling -------------- this function works nice/appropriate when you put it in the if statement. E.G. if($fhand->movFs($dir_filename,$new_dir_file)==true) : The first argument is the file and directory if appropriate E.G. ../images/image.jpg : The second argument is the new file name and directory if appropriate E.G. ../icons/image2.jpg if you specify the directory in the second argument, and is different from the source directory, it will firstly created the directory if it does'nt exit and then copy the file, then delete the file from the source when you use the if statement, your errors will be posted, and call them as: $fhand->f_err() ************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Copying a file $fhand->copFs($dir_filename,$new_dir_file); Error handling -------------- this function works nice/appropriate when you put it in the if statement. E.G. if($fhand->copFs($dir_filename,$new_dir_file)==true) : The first argument is the file and directory if appropriate E.G. ../images/image.jpg : The second argument is the new file name and directory if appropriate E.G. ../icons/image2.jpg if you specify the directory in the second argument, and is different from the source directory, it will firstly created the directory if it does'nt exit and then copy the file. when you use the if statement, your errors will be posted, and call them as: $fhand->f_err() ************************************************************************************************************************** ************************************************************************************************************************** ************************************************************************************************************************** Downloading a file $fhand->dowFs($filename_in_server,$file_name); Error handling -------------- this function works nice/appropriate when you put it in the if statement. E.G. if($fhand->dowFs($filename_in_server,$file_name)==true) : The first argument is the root/surce fiel E.G. ../images/200501011232150474image.jpg : The second argument is the file name that the user will download E.G. logo.jpg when you use the if statement, your errors will be posted, and call them as: $fhand->f_err()