PHP Classes

PHP Upload Multiple Images Ajax: Process uploaded images sent via AJAX requests

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 59%Total: 601 All time: 5,176 This week: 148Up
Version License PHP version Categories
upload-images-ajax 2.0.2GNU General Publi...5.0HTTP, PHP 5, Files and Folders, Valid..., A...
Description 

Author

This package can process uploaded images sent via AJAX requests.

It comes with jQuery plugin that can upload the one or more images using AJAX requests.

It can also display a preview of the selected images for upload, so the user can remove undesired images from the list of file to upload.

The PHP class can validate the uploaded images to check for valid image file name extensions, size limits, and limit number of uploaded files.

Picture of manudg
  Performance   Level  
Name: manudg <contact>
Classes: 6 packages by
Country: Spain Spain
Age: 43
All time rank: 159533 in Spain Spain
Week rank: 96 Up4 in Spain Spain Up

Recommendations

Upload images using AJAX
Trying to upload avatar file

Example

<?php
require "php/class.uploadImages.php";

$uploadImages = new uploadImages();

/* Images are required */
if ($uploadImages->countImages() > 0)
{
   
   
/* Default validation:
        $uploadImages->image_type = "jpg|jpeg|png|gif";
        $uploadImages->min_size = "";
        $uploadImages->min_size = 24;
        $uploadImages->max_size = (1024*1024*3);
        $uploadImages->max_files = 10;
    */
   
    /* Validate */
   
if ($uploadImages->validateImages())
    {
        print(
"<h3 class='text-info'>IMAGES</h3>");
       
/* images array */
       
$images = $uploadImages->getImages();
        foreach (
$images as $image)
        {
           
/* save the image */
           
if ($uploadImages->saveImage($image["tmp_name"], "images/", $image["name"]))
            {
                print (
"<p class='text-success'> <strong>" . $image["name"] . "</strong> saved in images folder</p>");
            }
            else
            {
                print(
"<p class='text-danger'> " . $image["name"] . " error to saved</p>");
            }
        }
       
/* GET EXTRA PARAMETERS */
       
print("<h3 class='text-info'>EXTRA PARAMETERS</h3>");
       
print_r($uploadImages->getParams());
    }
    else
/* Show errors array */
   
{
       
print_r($uploadImages->error);
    }
}
else
{
    print(
"<p class='text-danger'>images required</p>");
}


Screenshots  
  • screenshot-1
  Files folder image Files  
File Role Description
Files folder imageimages (1 file)
Files folder imagejs (1 file)
Files folder imagephp (1 file)
Accessible without login Plain text file ajax.php Example Example script
Accessible without login HTML file docs.html Doc. Documentation
Accessible without login Plain text file index.php Aux. Example script
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  images  
File Role Description
  Accessible without login Plain text file no-empty.txt Data Auxiliary data

  Files folder image Files  /  js  
File Role Description
  Accessible without login Plain text file uploadImages.js Data Auxiliary data

  Files folder image Files  /  php  
File Role Description
  Plain text file class.uploadImages.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 87%
Total:601
This week:0
All time:5,176
This week:148Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:80%StarStarStarStarStar
Documentation:70%StarStarStarStar
Examples:70%StarStarStarStar
Tests:-
Videos:-
Overall:59%StarStarStar
Rank:1422