In this article, we use an Ajax form submission plug-in: jqery. form. js. Someone has modified several lines of code and renamed it jquery. wallform. js. Let's take a look at this magical jQuery plug-in. Today, I want to share with you how to use PHP + jQuery + Ajax to upload multiple images without refreshing new pages. You only need to click to select the image to be uploaded, and then the image is automatically uploaded to the server and displayed on the page.
HTML
We place a form on the page and use post to submit it to the backend php processing program upload. php. Note that the enctype attribute setting must support file upload. # Preview is used to display the uploaded image. For more information about css style settings, see the source code of the downloaded package.
The Code is as follows:
The maximum size is KB. jpg, gif, and png formats are supported.
JQuery
This example is based on jQuery. Therefore, the jquery library and jquery. wallform. js must be loaded on the page.
The Code is as follows: