Ajax Multiple Image Upload-Resize with jQuery and PHP
If you are looking for multiple image uploader that doesn’t require flash plugin, here’s script that does it for you, it will nicely upload multiple image files and resize them using jQuery and PHP. User can easily add as many files before uploading and a nice progress bar lets you see the progress of the upload, but please note: progress bar requires modern browsers to function.
Thanks to Marc Heiduk for rewriting and sending me this modified version of Ajax Image Upload and Resize script with Progressbar. It was working nicely, processing multiple uploaded files, but I needed to modify it a little. This is a very nice script, but still you can run into errors while uploading big size files if settings aren’t set right in PHP.ini file, so make sure “upload_max_filesize“, “post_max_size” and “memory_limit” in PHP.ini file are adequate for big file uploading.
This script is modified version of previous single file uploader scripts, so you may also find other posts interesting Ajax Image Upload and Resize with jQuery and PHP and Ajax Image Upload with Progressbar with jQuery and PHP.
Upload form is presented to user with option to add/remove file input fields, you can limit how many input fields should be addable by users. Upload form is nicely styled with CSS file, and includes jQuery Ajax to upload files. Main thing to notice here is file input boxes, with attribute names “file“, this name creates an array of files which can be accessed using $_POST or $_FILES in upload.php or other receiver script, where these data will be posted.
Upload.php script processes the uploaded image files. Once file is uploaded PHP creates temporary copy of the uploaded files in the PHP temp folder, the variables posted from upload form with fields name file and other variables are retrieved here as an array using $_FILES, and then it simply copies temporary files from PHP tmp folder into destination folder.
Saran Chamling. (He loves the web technology, and enjoys designing, exploring and writing about it @saaraan.com).