PHP Classes
elePHPant
Icontem

File: session.inc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of M.G.Ranga Pathmasiri  >  File Uploading Web interface  >  session.inc.php  >  Download  
File: session.inc.php
Role: Auxiliary script
Content type: text/plain
Description: This file is used for set file information about user upload file
Class: File Uploading Web interface
Simple file uploading form handling
Author: By
Last change:
Date: 10 years ago
Size: 1,670 bytes
 

Contents

Class file image Download
<?php
 
 
// get file infortation
     
     
    
$file_name = $_FILES["file"]["name"];
    
$file_type = $_FILES["file"]["type"];
    
$tmp_name = $_FILES["file"]["tmp_name"];
    
$file_error = $_FILES["file"]["error"];
    
$file_size = $_FILES["file"]["size"];
    
    
     
// import session cart
if (isset( $_SESSION["fileinfo"]) && ($file_name) && isset($_SESSION["fileinfo"]["$file_name"]))
{
   
$file_cart = $_SESSION["fileinfo"];
   
      
$error = true;
      
$file_error = $error_array['alsohave'];
      
   
$file_cart [$file_name]["file_count"] = 1;
   
$file_cart [$file_name]["file_name"] = $file_name;
   
$file_cart [$file_name]["file_type"] = $file_type;
   
$file_cart [$file_name]["tmp_name"] = $tmp_name ;
   
$file_cart [$file_name]["file_size"] = $file_size;
 
    
   
   
}
else if(isset(
$_SESSION["fileinfo"]) && ($file_name))

{
   
$file_cart = $_SESSION["fileinfo"];
   
$file_cart [$file_name]["file_count"] = 1;
   
$file_cart [$file_name]["file_name"] = $file_name;
   
$file_cart [$file_name]["file_type"] = $file_type;
   
$file_cart [$file_name]["tmp_name"] = $tmp_name ;
   
$file_cart [$file_name]["file_size"] = $file_size;
    
}

else if (
$file_name)
{

   
$file_cart = array() ;
   
$file_cart [$file_name]["file_count"] = 1;
   
$file_cart [$file_name]["file_name"] = $file_name;
   
$file_cart [$file_name]["file_type"] = $file_type;
   
$file_cart [$file_name]["tmp_name"] = $tmp_name ;
   
$file_cart [$file_name]["file_size"] = $file_size;
     


}
//update session cart
if(isset($file_cart))
{
$_SESSION["fileinfo"] = $file_cart;
 
}
?>