In-depth analysis of the AjaxFileUpload implementation of a single file Ajax File Upload library, ajaxfileuploadajax
JQuery. AjaxFileUpload. js is a jQuery plug-in used to upload files through ajax.
Syntax:
$.ajaxFileUpload([options])
Options parameter description:
1. url upload handler address.
2. the ID of the file field to be uploaded by fileElementId, that is, the ID of <input type = "file">.
3. Whether secureuri enables secure submission. The default value is false.
4. Data Type returned by the dataType server. It can be xml, script, json, or html. If this parameter is left blank, jQuery will automatically judge it.
5. The processing function automatically executed after successful submission of success. The parameter data is the data returned by the server.
6. The processing function automatically executed when the error is submitted.
7. Custom data parameters. This is useful when data is related to uploaded images.
8. If you want to submit a custom parameter, set this parameter to post.
Features:
It does not rely on specific HTML, as long as it is given a "<INPUTTYPE =" file ">
It does not need to specify any specific method when your server responds.
Allows you to operate on large volumes of files.
Sample Code:
-- Use as little as --$('#one-specific-file').ajaxfileupload({'action': '/upload.php'});-- or as much as --$('input[type="file"]').ajaxfileupload({'action': '/upload.php','params': {'extra': 'info'},'onComplete': function(response) {console.log('custom handler for file:');alert(JSON.stringify(response));},'onStart': function() {if(weWantedTo) return false; // cancels upload},'onCancel': function() {console.log('no file selected');}});
For more information about how to use AjaxFileUpload to upload an Ajax file to a single file, I hope it will help you!
Articles you may be interested in:
- Jquery-ajaxfileupload asynchronous upload plug-in (with Engineering Code)
- Use the ajaxfileupload plug-in to implement non-refreshing File Upload Methods
- Example of asynchronous file upload using AjaxFileUpload. js
- PHP + ajaxfileupload + jcrop plug-in perfectly achieves Avatar upload and tailoring
- An example of a simple jQuery plug-in ajaxfileupload. js to implement ajax File Upload
- Use ajaxfileupload. js to upload files to php through ajax
- The ajaxFileUpload. js plug-in supports Multifile upload.
- ThinkPHP combined with AjaxFileUploader to implement the method of uploading non-refreshing files
- Asp.net + ajaxfileupload. js Implement Asynchronous file upload and code sharing
- PHP uses the jQuery plug-in ajaxFileUpload to Implement Asynchronous file upload.