jquery uploadify Plugin Multi-File upload configuration parameters detailed

Source: Internet
Author: User
Tags rar

Recently made a multi-file upload, you need to limit the upload file type examples. Have not done before to find some information, the next useful. At the same time also for everyone to do reference.

The relative path to the uploader:uploadify.swf file, which is a button with a text browse, and then fades out of the Open File dialog box, the default value: uploadify.swf.

Script: The relative path of the spooler. Default value: uploadify.php

Checkscript: The relative path of the spooler that is used to determine whether the uploaded file is present on the server

Filedataname: Sets a name for the server handler to fetch data from the uploaded file according to that name. Default is Filedata

Method: Submit by post or get default to post

Scriptaccess:flash the access mode of the script file, if the local test is set to always, the default value: Samedomain

Folder: The directory where files are uploaded.

Queueid: The ID of the file queue that matches the ID of the div holding the file queue.

Queuesizelimit: When multiple file generation is allowed, set the number of selected files, the default value: 999.

Multi: When set to true, multiple files can be uploaded.

Auto: Set to True when the file is selected and uploaded directly, false need to click the Upload button before uploading.

Filedesc: This property value must be set after the Fileext property is valid to set the prompt text in the Select File dialog box, such as setting Filedesc as "Please select RAR doc PDF File" To open the File selection box effect as:

Fileext: Sets the type of file that can be selected, in the form of ' *.doc;*.pdf;*.rar '.

SizeLimit: Size limit for uploaded files.

Simuploadlimit: The default number of simultaneous uploads is allowed: 1.

ButtonText: The text of the browse button, default: Browse.

BUTTONIMG: The path to the picture of the browse button.

Hidebutton: Set to True to hide the picture of the browse button.

Rollover: The value is true and False when set to True when the mouse moves over the browse button with a reversal effect.

Width: Set the browse button to the default value: 110.

Height: Sets the altitude of the browse button, the default value: 30.

Wmode: Setting this to transparent can make the flash background file of the browse button transparent, and the Flash file will be placed at the highest level of the page. Default value: Opaque.

CANCELIMG: Select the Close button icon on each file after the file is selected in the file queue, such as:

The value of the key described above is either a string or a Boolean type, which is simpler, and the value of the key to be introduced is a function that returns some information to the user when selecting a file, an error, or some other action.

OnInit: Do some initialization work.

OnSelect: triggered when selecting a file, the function has three parameters

Event: Events object.

Queueid: A unique identifier for the file, consisting of 6 random characters.

Fileobj: The selected file object has a name, size, CreationDate, Modificationdate, type 5 properties.

The code is as follows:

$ (document). Ready (function ()
{
$ ("#uploadify"). Uploadify ({
' Uploader ': ' js/jquery.uploadify-v2.1.0/uploadify.swf ',
' Script ': ' Uploadhandler.ashx ',
' cancelimg ': ' Js/jquery.uploadify-v2.1.0/cancel.png ',
' Folder ': ' UploadFile ',
' Queueid ': ' Filequeue ',
' Auto ': false,
' Multi ': true,
' OnInit ': function () {alert ("1");},
' OnSelect ': function (E, Queueid, fileobj)
{
Alert ("Unique ID:" + queueid + "" +
"File name:" + fileobj.name + "" +
"File Size:" + fileobj.size + "" +
"Creation time:" + fileobj.creationdate + "" +
"Last modified:" + Fileobj.modificationdate + "" +
"File type:" + Fileobj.type
);

}
});
});

When you select a file, the message pops up like this:

Onselectonce: Triggered when a file is selected in a single file or multiple file upload. The function has two parameters Event,data,data object has the following properties:

FileCount: Select the total number of files.

filesselected: Select the number of files at the same time, if you select 3 files at a time, the property value is 3.

Filesreplaced: If A and b two files already exist in the file queue, select a and B when selecting the file again, and the property value is 2.

Allbytestotal: The total size of all selected files.

OnCancel: Triggered when you click the Close button of a file in the file queue or click Cancel upload. The function has event, Queueid, Fileobj, data four parameters, the first three parameters with

There are three parameters in Onselect, and the data object has two properties FileCount and Allbytestotal.

FileCount: The number of files remaining in the file queue after a file is canceled.

Allbytestotal: The size of the remaining files in the file queue after canceling a file.

Onclearqueue: Triggered when the function fileuploadclearqueue is called. There are two parameters for event and data, and two corresponding parameters in OnCancel.

Onqueuefull: Triggered when Queuesizelimit is set and the number of files selected exceeds the value of Queuesizelimit. The function has two parameters of event and Queuesizelimit.

OnError: Triggered when an error occurs during upload. The function has the event, Queueid, Fileobj, errorobj four parameters, of which the first three parameters, Errorobj object has type and info two properties.

Type: Error types, there are three kinds of ' HTTP ', ' IO ', or ' Security '

Info: Description of the error

OnOpen: Triggered when the upload is clicked, if Auto is set to true, it is triggered when the file is selected, and if more than one file is uploaded, the entire file queue is traversed. The function has the event, Queueid, fileobj three parameters, the parameter is interpreted as above.

OnProgress: Triggered when the upload is clicked, if Auto is set to true, it is triggered when the file is selected, and if more than one file is uploaded, it traverses the entire file queue and fires after OnOpen. This function has event, Queueid, Fileobj, data four parameters, the first three parameters are explained above. The data object has four properties percentage, bytesloaded, allbytesloaded, Speed:

Percentage: Percentage of current completion

Bytesloaded: The size of the current upload

Allbytesloaded: The size of the file queue that has already been uploaded

Speed: Upload Rate kb/s

OnComplete: Triggers when file upload is complete. The function has four parameters event, Queueid, Fileobj, response, data five parameters, the first three parameters ibid. Response is the value returned by the spooler, in the example above, 1 or 0,data has two properties FileCount and speed

FileCount: The number of files remaining without uploading completed.

Speed: Average rate of file uploads kb/s

Onallcomplete: Triggers when all files in the file queue are uploaded. The function has an event and data two parameters, and data has four properties, respectively:

Filesuploaded: The number of uploaded files.

Errors: The number of errors occurred.

Allbytesloaded: The total size of all uploaded files.

Speed: Average upload rate kb/s

Introduction to related functions

In the above example, Uploadifyupload and uploadifyclearqueue two functions have been used, in addition to several functions:

Uploadifysettings: You can dynamically modify the key values described above, such as the following code

$ (' #uploadify '). Uploadifysettings (' folder ', ' JS ');

If the Upload button event is written as follows, the file will be uploaded to the directory defined in the Uploadifysettings

<a href= "javascript:$ (' #uploadify '). Uploadifysettings (' folder ', ' JS ');

$ (' #uploadify '). Uploadifyupload () "> Upload </a>

Uploadifycancel: The function accepts a queueid as a parameter that cancels the file specified Queueid in the file queue.

$ (' #uploadify '). Uploadifycancel (ID);

Translated from: Http://hi.baidu.com/whlxjq520/item/7aed756f9b915c0fa1cf0f40

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.