PHP Classes

File: save_files.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes 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: 8 years ago
Size: 1,659 bytes


Class file image Download
        CopyRight ADE 2005-2006

        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
$send_now = new multiple_upload; //create instance
///home/httpd/vhosts/ doesw not work properly
//set some values This is the whole path to! the upload dir
$send_now->uploaddir = "/home/httpd/vhosts/";//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);
"Error report, sending files to server <br />";
    for (
$i=0; $i<$i_errors;$i++) {
$send_now->errors[0][$i] . " <br />";
$send_now->errors[1][$i] . " <br />";
} else {
header("Location: ". "../test_upload.htm");//redirect to something