Ratings | | Unique User Downloads | | Download Rankings |
Not yet rated by the users | | Total: 405 | | All time: 6,520 This week: 66 |
|
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. | |
|
Recommendations
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
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.