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.
For the preview and validate images in the client side
image_type: "jpg|jpeg|png|gif", min_size: 24, max_size: (1024*1024*3), max_files: 10
switch(__errors__upload__) /* Check the possibles erros */ { case 'ERROR_CONTENT_TYPE': alert("Error content type"); break; case 'ERROR_MIN_SIZE': alert("Error min size"); break; case 'ERROR_MAX_SIZE': alert("Error max size"); break; case 'ERROR_MAX_FILES': alert("Error max files"); break; default: $("#btn").removeAttr("disabled"); break; /* Activate the button Form */ }
Return the number of images.
Boolean. Check if File Api is compatible in the web browser.
Upload the images and send parameters for an asynchronous HTTP (Ajax) request.
params: {}, type: 'POST', beforeSend: function(){}, success: function(){}, error: function(){}, complete: function(){}
Validate, get the parameters and save the images.
public $image_type = "jpg|jpeg|png|gif"; public $min_size = 24; public $max_size = (1024*1024*3); public $max_files = 10; public $error = array();
Return the number of images
Return one array with the images information -> "error", "name", "size", "tmp_name", "type"
Return one array with the extra parameters
Save the image
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.