Simple Multiple File Upload

Upload Files
Add Icon

Usage

Step 1:

To use the simple multiple file upload script, first include the "class.file_upload.php" at the top of your script.

require_once "./php/functions.inc.php";

Step 2:

Create the parameters array that will pass all the variables to the script. Most have been defined as a default but you can override them by passing them to the class

$params = array(
// path of the upload directory relative to the document root
'upload_dir'=>'Testing/file_upload/uploaded_files'
);

Step 3:

Instantiate the class, passing your parameters as an argument

$upload = new FileUpload($params);

Step 4:

When the form is submitted call the "do_upload()" method to process the $_FILES array and save the uploaded files

$upload->do_upload();

Step 5:

The class will make a note of all successful and unsuccessful file uploads so that you can display these to the user

$errors = $upload->errors;
$uploaded_files = $upload->uploaded_files;

Step 6:

The PHPMailer class has been included and the Upload class updated so that uploaded files can now be emailed as attachements. Simply change the email details (e.g. From, To, Subject, Body) and the email will be sent automatically. The script will show an error if the email failed.