Edit
by Marc Covert - 9 years ago (2016-02-27)
Trying to upload avatar file
| I am trying to upload avatar file using AJAX. |
Ask clarification
3 Recommendations
File Upload With AJAX: Handle file uploads and returns JSON response
This is a simple class that can handle file uploads and returns JSON response.
It can take the $_FILES array as parameter and checks if a file with a given input name was uploaded successfully.
If the file was received, it is moved to the uploads directory.
The class creates an array with the response details and outputs the array JSON encoded so it is easier for the JavaScript to handle.
The details include a success message with a download link, and the name of the file that was stored. If the upload fails, an error message is returned.
| by Bharat Parmar package author 455 - 9 years ago (2016-04-11) Comment
This class will upload the any image file with ajax on selection of the file. |
PHP Multi File Uploader: Validate and process one or more file uploads
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.
| by MOUSTAFA ELGAMMAL package author 215 - 9 years ago (2016-02-29) Comment
but not ajax |
- 6 Comments
1.
by Dave Smith - 9 years ago (2016-02-29) Reply
While it is great to take pride in your own package, this one does not address the primary requirement that it be through ajax.
2.
by MOUSTAFA ELGAMMAL
package author - 9 years ago (2016-02-29) in reply to comment 1 by Dave Smith Reply
thanks about your opinion, but you are not the one who set the primary requirements.
3.
by Manuel Lemos - 9 years ago (2016-02-29) Reply
Your class is fine for handling uploads, and it seems Marc wants a package that does that, as well does the browser side part using AJAX to submit the image without reloading the page.
4.
by MOUSTAFA ELGAMMAL
package author - 9 years ago (2016-03-01) in reply to comment 3 by Manuel Lemos Reply
ok, I understand now.
5.
by Manuel Lemos - 9 years ago (2016-03-01) in reply to comment 4 by MOUSTAFA ELGAMMAL Reply
If you add the AJAX JavaScript code generation to your class so it can do the whole work, we can revert the vote and recommend your class too.
6.
by Haseeb Ahmad Basil - 9 years ago (2016-03-09) Reply
Not what is requested
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.
| by Manuel Lemos 26695 - 9 years ago (2016-02-28) Comment
This class is very good for that purpose. It uses a jQuery plugin that not only can take care of the image file upload via AJAX, but it also shows a preview of the image to be uploaded.
It also supports multiple file uploads in case you need them. |