PHP Classes

PHP Multi File Uploader: Validate and process one or more file uploads

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 404 This week: 1All time: 6,524 This week: 560Up
Version License PHP version Categories
multi-file-uploader 1.1GNU General Publi...5HTTP, PHP 5, Files and Folders, Valid...
Description 

Author

This class can validate and process one or more file uploads.

There is one class that can validate and process individual file uploads. It checks if the file name extension and MIME type is one of the allowed, as well if the file size is below the allowed size limit.

The class can create the destination directory if it does not exists and move the uploaded file to that directory.

Another class calls the first to validate and process multiple files being uploaded.

Picture of MOUSTAFA ELGAMMAL
  Performance   Level  
Name: MOUSTAFA ELGAMMAL <contact>
Classes: 1 package by
Country: Egypt Egypt
Age: 29
All time rank: 353040 in Egypt Egypt
Week rank: 411 Up6 in Egypt Egypt Up

Recommendations

Upload any type of files
Check all the files based on the content

PHP code to identify uploaded file format
I need a code to identify the file format of uploaded file

What is the best PHP AJAX file upload class?
I want to upload files using AJAX

Upload images using AJAX
Trying to upload avatar file

Large file upload handler
Looking for class that will handle large file uploads

upload .txt file
I need code for upload .txt file

Upload multiple images path
I need to upload multiple images from one file tag in HTML

upload multiple files
I need script for upload multiple files and images

Example

<form action="example_for_multi_files_upload.php" method="post"
    enctype="multipart/form-data">
    <input type="file" name="images[]" multiple /> <input type="submit"
        name="submit" />
</form>
<hr>
<?php
require_once 'classes/MultiFileUploader.class.php';

if (isset (
$_POST ['submit'] )) {
    echo
"<pre>";
   
// var_dump($_FILES['images']);
   
if (isset ( $_FILES ['images'] )) {
       
$files_data = $_FILES ['images'];
       
$uploading_directory = 'uploads/multi'; // uploading directory
       
        /**
         * for example if your upload images
         *
         * @var $files_types
         */
       
$files_types = array (
               
'image/jpg',
               
'image/jpeg',
               
'image/png',
               
'image/gif'
       
);
       
       
/**
         * for example exts types of the images
         *
         * @var $files_exts
         */
       
$files_exts = array (
               
'jpg',
               
'jpeg',
               
'gif',
               
'png'
       
);
       
       
// new object of the MultiFileUploader class
       
$up = new MultiFileUploader ( $files_data, $uploading_directory, $files_types, $files_exts );
       
       
$up->start_upload (); // init files data
       
        /**
         * MultiFileUploader::finish_upload ()
         * upload the files with check every validation
         * then @return an array with to index
         * 1st index "uploaded": the names of the uploaded files
         * 2nd index "errors" : array of errors of Invalid files validation
         */
       
var_dump ( $up->finish_upload () );
    }
}

?>



Details

multi_files_uploader_class

Multi Files uploader is two classes to upload file or more with on input file html, with validation of the file type, size and extention;then move uploaded files.

# note

this repository contain two class:

1st uploader{} in upload.class.php file
  #the real owner is The software engineer "Ahmed Syam"
  @contact him :engsyam@gmail.com
  @copyright www.softmasr.com
  # http://www.phpclasses.org/package/8475-PHP-Validate-and-move-an-uploaded-file.html
  # this class you can use it to upload on single file 

2nd is mine MultiFileUploader{} in MultiFileUploader.class.php
  # this one uses the 1st to upload multi file
  # Moustafa Mohammed Elgammal
  # https://eg.linkedin.com/in/moustafa-mohammed-elgammal-7823a393
  @contact me :moustafa_algammal@yahoo.com
  

  Files folder image Files  
File Role Description
Files folder imageclasses (2 files)
Files folder imageuploads (1 file)
Accessible without login Plain text file example_for_multi_files_upload.php Example multi files exampe
Accessible without login Plain text file example_for_single_file_upload.php Example single dile example
Accessible without login Plain text file LICENSE Lic. GNU license
Accessible without login Plain text file README.MD Doc. read me file

  Files folder image Files  /  classes  
File Role Description
  Plain text file MultiFileUploader.class.php Class multi files uploader class
  Plain text file upload.class.php Class the main single file upload

  Files folder image Files  /  uploads  
File Role Description
  Accessible without login Plain text file uploads Data uploads dir

 Version Control Unique User Downloads Download Rankings  
 0%
Total:404
This week:1
All time:6,524
This week:560Up