jquery Upload plugin uploadify 3.2 use

Source: Internet
Author: User
Tags jquery library

uploadify:http://www.uploadify.com/download/ here to download the latest version of the 3.2.
Download down the decompression after the estimate of a lot of files, in fact, useful also a jquery.uploadify.js and uploadify.swf these two files. Of course, the jquery library is a must.
In the project you are using, the jquery.uploadify.js is introduced to the same use as most JQ plugins. Also remember to introduce swfobject.js this plugin, version 2.2 or more. Use methods such as:

$ (function () {

    $ ("#file_upload_1"). Uploadify ({        height        : $,        swf           : '/uploadify/uploadify.swf ',        uploader      : '/uploadify/uploadify.php ',        width         : +});    

File_upload_1 is actually a container ID, such as the above is just a simple case, the following I have done in the project to send out, each has an explanation:

$ (document). Ready (function() {    $("#file_upload"). uploadify ({//Start Debugging' Debug ':false,        //whether to upload automatically' Auto ':false,        //Timeout period' Successtimeout ': 99999,        //included Values' FormData ':{            ' userid ': ' User ID ',            ' username ': ' User name ',            ' Rnd ': ' Encrypted text '        },        //Flash' swf ': ' uploadify.swf ',        //do not perform the default onselect event' Overrideevents ': [' ondialogclose '],        //container ID after file selection' Queueid ': ' Uploadfilequeue ',        //The name of the file object used by the server-side script $_files [' upload ']' Fileobjname ': ' Upload ',        //Upload Handler' Uploader ': ' imageupload.php ',        //the path of the background picture of the browse button' Buttonimage ': ' Upbutton.gif ',        //width of the browse button' Width ': ' 100 ',        //height of the browse button' Height ': ' 32 ',        //the path to the expressinstall.swf file. ' Expressinstall ': ' expressinstall.swf ',        //text displayed in the File Type drop-down menu at the bottom of the Browse window' Filetypedesc ': ' Supported formats: ',        //allow file suffixes to be uploaded' filetypeexts ': ' *.jpg;*.jpge;*.gif;*.png ',        //size limit for uploaded files' Filesizelimit ': ' 3MB ',        //Upload Quantity' Queuesizelimit ': 25,        //progress for each update of uploaded files' Onuploadprogress ':function(file, bytesuploaded, Bytestotal, totalbytesuploaded, totalbytestotal) {//sometimes upload progress what want to own personalized control, can use this method             //See official instructions for how to use        },        //Select Upload file after calling' OnSelect ':function(file) {},//returns an error that is triggered when a file is selected' Onselecterror ':function(file, ErrorCode, errormsg) {Switch(errorCode) { Case-100: Note that the change prompt should be in THIS.QUEUEDATA.ERRORMSG =, if you use alert, there will be two frames.//alert ("The number of uploaded files has exceeded the system limit" +$ (' #file_upload '). Uploadify (' Settings ', ' queuesizelimit ') + "Files! ");                     Break;  Case-110: Alert ("File [" +file.name+ "] size exceeds the system limit of" +$ (' #file_upload '). Uploadify (' Settings ', ' filesizelimit ') + "size! ");  Break;  Case-120: Alert ("File [" +file.name+ "] size is abnormal! ");  Break;  Case-130: Alert ("File [" +file.name+ "] type is incorrect! ");  Break;} Switch(errorCode) { Case-100:                         This. queuedata.errormsg = "The number of uploaded files has exceeded the system limit" + $ (' #photofile '). Uploadify (' Settings ', ' queuesizelimit ') + "Files! ";  Break;  Case-110:                         This. queuedata.errormsg = "file [" + File.name + "] size exceeds system limit" + $ (' #photofile '). Uploadify (' Settings ', ' filesizelimit ') + "size! ";  Break;  Case-120:                         This. queuedata.errormsg = "file [" + File.name + "] Size exception! ";  Break;  Case-130:                         This. queuedata.errormsg = "file [" + File.name + "] type is incorrect! ";  Break; If the above tips are still in English, you can use the following methodSwitch(errorCode) { Case-100:                         This. queuedata.errormsg = "The number of uploaded files has exceeded the system limit" + $ (' #photofile '). Uploadify (' Settings ', ' queuesizelimit ') + "Files! ";  Break;  Case-110:                         This. queuedata.errormsg = "file [" + File.name + "] size exceeds system limit" + $ (' #photofile '). Uploadify (' Settings ', ' filesizelimit ') + "size! ";  Break;  Case-120:                         This. queuedata.errormsg = "file [" + File.name + "] Size exception! ";  Break;  Case-130:                         This. queuedata.errormsg = "file [" + File.name + "] type is incorrect! ";  Break; }        },        //detect Flash failed call' Onfallback ':function() {alert ("You can't upload a picture without the Flash control installed!" Please install the Flash control and try again. "); },        //uploaded to the server, the server returns the corresponding information to the data.' Onuploadsuccess ':function(file, data, response) {alert (data); }    });});
JS Code and explanations

jquery Upload plugin uploadify 3.2 use

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.