PHP Classes
elePHPant
Icontem

File Handling: Perform several operations to manipulate files

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2007-03-05 (9 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,730 All time: 2,195 This week: 1,099Up
Version License Categories
filehand 1.0GNU General Publi...Files and Folders
Description Author

This is a simple class that can be used to perform several types of file manipulation operations like: handle uploaded files, serve files for downloading, renaming, deleting, copy and moving a file.

Picture of Peter Molefe Ramokone
Name: Peter Molefe Ramokone <contact>
Classes: 4 packages by
Country: South Africa South Africa

Details
// --------------------------------------------------------------------------------
// 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()	
  Files folder image Files  
File Role Description
Plain text file filehand.doz.php Class Class file
Accessible without login Plain text file example.php Example Example
Accessible without login Plain text file readme.txt Doc. Read me

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,730
This week:0
All time:2,195
This week:1,099Up