Login   Register  
PHP Classes
elePHPant
Icontem

File: end_sample_script.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jeffrey Johns  >  File Uploader  >  end_sample_script.php  >  Download  
File: end_sample_script.php
Role: Example script
Content type: text/plain
Description: Sample class calling script.
Class: File Uploader
Complete file uploading class
Author: By
Last change:
Date: 2003-08-05 02:01
Size: 1,406 bytes
 

Contents

Class file image Download
<?php
$upload_class 
= new Upload_Files;
$upload_class->temp_file_name trim($_FILES['upload']['tmp_name']);
$upload_class->file_name trim(strtolower($_FILES['upload']['name']));
$upload_class->upload_dir "uploads/";
$upload_class->upload_log_dir "uploads/upload_logs/";
$upload_class->max_file_size 5242880;
$upload_class->banned_array = array("");
$upload_class->ext_array = array(".zip",".rar",".ace",".tar");

$valid_ext $upload_class->validate_extension();
$valid_size $upload_class->validate_size();
$valid_user $upload_class->validate_user();
$max_size $upload_class->get_max_size();
$file_size $upload_class->get_file_size();
$file_exists $upload_class->existing_file();

    if (!
$valid_ext) {
        
$result "The file extension is invalid, please try again!";
    }
    elseif (!
$valid_size) {
        
$result "The file size is invalid, please try again! The maximum file size is: $max_size and your file was: $file_size";
    }
    elseif (!
$valid_user) {
        
$result "You have been banned from uploading to this server.";
    }
    elseif (
$file_exists) {
        
$result "This file already exists on the server, please try again.";
    } else {
        
$upload_file $upload_class->upload_file_with_validation();
        if (!
$upload_file) {
            
$result "Your file could not be uploaded!";
        } else {
            
$result "Your file has been successfully uploaded to the server.";
        }
    }
?>