Upload Multiple Images Ajax - (PHP + jQuery + Bootstrap) *|__demostration__|*

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.

jQuery Plugins


$(element).uploadImagesPreview(form [required], options [optional], callback [optional])

For the preview and validate images in the client side


$(element).countImages()

Return the number of images.

$.fileReader()

Boolean. Check if File Api is compatible in the web browser.

$(element).uploadImagesAjax(url [required], options [optional])

Upload the images and send parameters for an asynchronous HTTP (Ajax) request.

Events:


PHP Class

uploadImages() class

Validate, get the parameters and save the images.

Publics properties and defaults values:

			public $image_type = "jpg|jpeg|png|gif";
			public $min_size = 24;
			public $max_size = (1024*1024*3);
			public $max_files = 10;
			public $error = array();
		

Public functions:


public function countImages()

Return the number of images

public function getImages()

Return one array with the images information -> "error", "name", "size", "tmp_name", "type"

public function getParams()

Return one array with the extra parameters

public function saveImage($tmp_name, $folder, $image_name)

Save the image

public function validateImages()

Validate the images with the values of the public properties: $image_type, $min_size, $max_size and $max_files. If is valid return true. If an image is invalid, the error property is an array with that information.