PHP Classes

File: save_files.php

Recommend this page to a friend!
  Packages of Stoltenkamp   Multiple file upload   save_files.php   Download  
File: save_files.php
Role: Example script
Content type: text/plain
Description: save_files initiate class
Class: Multiple file upload
Validate and process files uploaded using forms
Author: By
Last change:
Date: 20 years ago
Size: 1,659 bytes
 

 

Contents

Class file image Download
<?php
/*
        CopyRight © ADE 2005-2006
        http://www.ade-solutions.nl
*/
/*

        Multiple File Upload (class)
        Is copyrighted, but free to use for non commercial use.
        But please let this notice intact!

        Multiple File Upload (class).php
        Simplyfied uploading file's to a webserver.
        Included are for demonstration 2 file's
        test_upload.htm : how to implement a save action
        save_files.php  : how to initiate the class
*/
include("multiple_file_upload_class.php");
$send_now = new multiple_upload;                //create instance
///home/httpd/vhosts/ade-solutions.nl/httpdocs/cees/upload/ doesw not work properly
//set some values         This is the whole path to! the upload dir
$send_now->uploaddir     = "/home/httpd/vhosts/ade-solutions.nl/httpdocs/cees/upload/";//set server upload dir
$send_now->max_files     = 10;                    //set max files to upload
$send_now->max_size     = 250000;                //set max file-size
$send_now->permission     = 0777;                     //set wanted permission
$send_now->notallowed     = array("exe"."mp3");    //excluide some file-types
$send_now->show            = TRUE;                    //show errors
$send_now->files         = &$_FILES;                //get $_FILES global values

//validate on size and allowed files
$ok = $send_now->validate();
if ($ok) {
    $ok = $send_now->execute();
}
if (!$ok && $send_now->show) {
    //echo perhaps some errors
    $i_errors = count($send_now->errors);
    echo "Error report, sending files to server <br />";
    for ($i=0; $i<$i_errors;$i++) {
        echo $send_now->errors[0][$i] . " <br />";
        echo $send_now->errors[1][$i] . " <br />";
    }
} else {
    header("Location: ". "../test_upload.htm");//redirect to something
}
?>