JQuery mobile Image Upload Component and jquery Image Upload Component

Source: Internet
Author: User

JQuery mobile Image Upload Component and jquery Image Upload Component

This article provides an example of the mobile Image Upload Component for your reference. The details are as follows:

Imageupload
Use File API + canvas client to compress images and upload files to the server

File dependency JQUERY

Parameter API

Loading: '. loading'. The loading icon selector is displayed on the page.
Url: '', the api address for receiving data
MaxFileSize: 1010241024, the maximum size of a single file supported by the server
Format:/^ image/I, supported file format. images text .....
IsCompress: true. If it is an image, you can enable client compression to reduce transmitted data files.
CompressNum: 0.6, image compression rate, 0 ~ 1. If it is set to 1, the final result may be greater than that not compressed. Please use it with caution. 1.
BeforeUpload: function () {}, for processing before uploading, false is returned to prevent file upload.
UploadStart: function () {}, start upload callback
AfterUpload: function () {}, callback of the end of the upload
UploadProgress: function (v) {} upload progress bar
UploadError: function () {} upload error callback
ShowThumbnail: function () {} display thumbnail

Example:

<Div id = "proccess"> </div> before compression: <div id = "rrr1"> </div> <br> <input type = "file" multiple id = "filesss"> <br> after compression: <div id = "rrr2"> </div> <br>
$ ('# Filess '). mobileUpload ({url: '', beforeUpload: function () {console. log ('beforeupload')}, uploadStart: function (file) {console. log ('uploadstart') console. log ('size of the original file: '+ file. length) ;}, uploadProgress: function (v) {console. log ('Progress '+ v)}, uploadError: function () {console. log ('uploaderror')}, showThumbnail: function (file) {$ ('# rrr1 '). append ('') ;}, afterUpload: function (file, data) {console. log ('compressed size: '+ file. length); $ ('# rrr2 '). append (' ');}});

The above is the mobile Image Upload component, which is very practical and I hope you will like it.

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.