Html5 supports multi-image preview upload and drag-and-drop controls,

Source: Internet
Author: User

Html5 supports multi-image preview upload and drag-and-drop controls,

An easy-to-use control was found during Image Upload. Multiple images can be uploaded at the same time. You can click and select an image or drag the image to the upload box for direct upload, which is convenient and easy to use, the interface is also simple and can be directly used in projects.

First look at his style:

After selecting an image:

$ (Function () {// initialize the plug-in $ ("# demo "). zyUpload ({width: "650px", // width height: "400px", // width itemWidth: "120px", // itemHeight: "100px ", // file item height url: "/upload/UploadAction", // File upload path multiple: true, // whether multiple files can be uploaded dragDrop: true, // whether the file del can be dragged and uploaded: true, // whether the file finishDel can be deleted: false, // whether to delete preview after the file is uploaded/* external callback interface */onSelect: function (files, allFiles) {// select the file callback method lele.info ("the following files are selected currently:"); console.info (files); console.info ("files not uploaded before :"); console.info (allFiles) ;}, onDelete: function (file, surplusFiles) {// callback Method for deleting a file lele.info ("this file is deleted currently :"); console.info (file); console.info ("remaining files:"); console.info (surplusFiles) ;}, onSuccess: function (file) {// callback Method for successful file upload: lele.info ("this file has been uploaded successfully:"); console.info (file) ;}, onFailure: function (file) {// callback Method for file upload failure console.info ("This file Upload Failed:"); console.info (file) ;}, onComplete: function (responseInfo) {// callback Method for upload completion: lele.info ("File Upload completed"); console.info (responseInfo );}});});

Modify the configuration directly in demo. js. url: "/upload/UploadAction" put your Image upload action. This control is only processed by the front-end, and you have to write it yourself for background upload.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.