JQuery plugin AjaxFileUpload implements ajax file upload and jqueryajax upload plugin
This article provides examples to share with you the specific code of AjaxFileUpload for file upload. The specific content is as follows:
The jQuery plug-in AjaxFileUpload is used to upload ajax files. This plug-in is very simple to use. Next I will write a demo to demonstrate how to use the AjaxFileUpload plug-in to upload files.
1. Introduce js related to the AjaxFileUpload plug-in
Copy codeThe Code is as follows: <script type = "text/javascript" src = "<% = basePath %> resources/js/jquery-1.2.1.js"> </script>
<Script type = "text/javascript" src = "<% = basePath %> resources/js/ajaxfileupload. js"> </script>
Note: The test shows that ajaxfileupload has requirements for the jQuery version. in use, ajaxfileupload must be consistent with the js version corresponding to jQuery. Otherwise, an exception may occur. You can download it from the official website of ajaxfileupload, avoid version conflicts.
2. Code for implementing the upload function
<% @ Page language = "java" import = "java. util. * "pageEncoding =" UTF-8 "%> <% @ include file ="/base. jsp "%> <% String path = request. getContextPath (); String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
The above is all the content of this article, and I hope it will help you learn jquery programming.