Login   Register  
PHP Classes
elePHPant
Icontem

File: uploaded_file.class.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Sven Wagener  >  File class  >  uploaded_file.class.php  
File: uploaded_file.class.php
Role: Class source
Content type: text/plain
Description: Extends file class with special uploaded file functions
Class: File class
File manipulation and form upload handling
 

Contents

Class file image Download
<?
/**
* Uploaded file handling class
*
* @author    Sven Wagener <wagener_at_indot_dot_de>
* @include      Funktion:_include_
*/
include("file.class.php");

class 
uploaded_file extends file{
    var 
$upload_name;
    var 
$upload_tmp_name;
    var 
$upload_size;
    var 
$upload_type;
    
    
/**
    * Constructor of class
    * @param array $file_form_array $_FILE Array of uploaded file
    * @return boolean $file_exists Returns TRUE if file is ok, FALSE if file is faked
    * @desc Constructor of class
    */
    
function uploaded_file($form_file_array,$binary=false){
        if(
$form_file_array['size']!=0){
            
$this->file=$file_form_array;
            
$this->upload_name=$form_file_array['name'];
            
$this->upload_tmp_name=$form_file_array['tmp_name'];
            
$this->upload_size=$form_file_array['size'];
            
$this->upload_type=$form_file_array['type'];
            
$this->file($form_file_array['tmp_name'],$binary);
        }else{
            
$this->halt("File size must be more than 0 bytes");
            return 
false;
        }
    }
    
    
/**
    * Returns real filename
    * @return string $file_name The real filename
    * @desc Returns real filename
    */
    
function get_upload_name(){
        return 
$this->upload_name;
    }
    
    
/**
    * Returns temporary name of file, given by the form
    * @return string $file_tmp_name The temporary filename, given by the form
    * @desc Returns temporary name of file, given by the form
    */
    
function get_upload_tmp_name(){
        return 
$this->upload_tmp_name;
    }
    
    
/**
    * Returns file size, given by the form
    * @return int $file_size The file size, given by the form in bytes
    * @desc Returns the file size, given by the form
    */
    
function get_upload_size(){
        return 
$this->upload_size;
    }
    
    
/**
    * Returns file type, given by the form
    * @return string $file_type The file type, given by the form
    * @desc Returns file type, given by the form
    */
    
function get_upload_type(){
        return 
$this->upload_type;
    }
}

?>