---
title: "Jquery uploadify插件可选参数的详细介绍"
author: "deleiguo"
date: "2011-09-30T10:31:00Z"
tags: []
categories: ["Web前端"]
slug: "jquery-uploadify"
draft: false
lastmod: "2011-12-22T02:14:05Z"
id: 1320143
url: "https://deleiguo.iteye.com/blog/1320143"
---

**以下是可选项的参数说明：（红色的属性代表常用的)**

&lt;wbr&gt;&lt;/wbr&gt;

**1**

**uploader**

上传控件的主体文件，flash控件

&lt;wbr&gt;&lt;wbr&gt; 默认值='uploadify.swf'&lt;/wbr&gt;&lt;/wbr&gt;

**2**

**script**

**&lt;wbr&gt;&lt;/wbr&gt;**

**相对路径的后端脚本，它将处理您上传的文件。**

**绝对路径前缀或'/'或'http'的路径**

**&lt;wbr&gt; 默认值='uploadify.php'&lt;/wbr&gt;**

**3**

**checkScript**

**&lt;wbr&gt;&lt;/wbr&gt;**

检查该文件是否已经选择驻留在服务器上。  
没有默认值。 官方例子中'check.php'是提供核心文件

**4**

**scriptData**

**&lt;wbr&gt;&lt;/wbr&gt;**

**可提供URL传递参数。用来传递get参数。例如：**

**&lt;wbr&gt; index.jsp?id=1&amp;action=uploadify可以设置成：&lt;/wbr&gt;**

**'script': 'index.jsp',**

**'scriptData':{'id':1,'action':'uploadify'},**

**注：要设置‘method’：‘GET’.**

**&lt;wbr&gt;&lt;/wbr&gt;**

**5**

**fileDataName**

**&lt;wbr&gt;&lt;/wbr&gt;**

&lt;wbr&gt;您的文件在上传服务器脚本阵列的名称。&lt;br&gt;&lt;wbr&gt;&lt;wbr&gt; 默认值='Filedata'&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;

**6**

**method**

**&lt;wbr&gt;&lt;/wbr&gt;**

&lt;wbr&gt;设置为发送到后端脚本的方法。要么'get'或post'。&lt;/wbr&gt;

&lt;wbr&gt;&lt;wbr&gt; 默认值'post'&lt;/wbr&gt;&lt;/wbr&gt;

**7**

[**scriptAccess**]()

**&lt;wbr&gt;&lt;/wbr&gt;**

**&lt;wbr&gt;?&lt;/wbr&gt;**

**8**

**folder**

**&lt;wbr&gt;&lt;/wbr&gt;**

您想将文件保存到的路径。考虑到安全问题，一般并不在客户端设定后供服务器得到所存的路径。我试了下。这个参数好像以get的方式传递的。设定post得不到这个值。

**9**

**queueID**

**&lt;wbr&gt;&lt;/wbr&gt;**

&lt;wbr&gt;文件队列ID。与div的id一致。&lt;/wbr&gt;

**10**

**queueSizeLimit**

**&lt;wbr&gt;&lt;/wbr&gt;**

**限制在一次队列中的次数（可选定几个文件）。默认值= 999，而一次可传几个文件有 simUploadLimit属性决定**。

**11**

**multi**

**&lt;wbr&gt;&lt;/wbr&gt;**

**是否允许同时上传多文件，可设定true或false。**

**&lt;wbr&gt; 默认false。设定true时，选中的文件是当前项。&lt;/wbr&gt;**

**12**

**auto**

&lt;wbr&gt;&lt;/wbr&gt;

**选定文件后是否自动上传，可设定true或false。**

**&lt;wbr&gt; 默认false&lt;/wbr&gt;**

**13**

**fileDesc**

**&lt;wbr&gt;&lt;/wbr&gt;**

**出现在上传对话框中的文件类型描述。与fileExt需同时使用**

**14**

**fileExt**

**&lt;wbr&gt;&lt;/wbr&gt;**

**支持的格式，启用本项时需同时声明fileDesc。**

**如：‘\*.rar,\*.doc**

**&lt;wbr&gt;&lt;/wbr&gt;**

**15**

**sizeLimit**

**&lt;wbr&gt;&lt;/wbr&gt;**

**控制上传文件的大小，单位byte**

**16**

**simUploadLimit**

**&lt;wbr&gt;&lt;/wbr&gt;**

**多文件上传时，同时上传文件数目限制。默认1**

**&lt;wbr&gt; 一次可传几个文件。&lt;/wbr&gt;**

**17**

**buttonText**

**&lt;wbr&gt;&lt;/wbr&gt;**

**默认按钮的名字。默认BROWER**

**18**

[]()[**buttonImg**]()

**&lt;wbr&gt;&lt;/wbr&gt;**

使用图片按钮，设定图片的路径即可。

**19**

**hideButton**

**&lt;wbr&gt;&lt;/wbr&gt;**

上传按钮的隐藏。true 或false。默认flase

**20**

**rollover**

**&lt;wbr&gt;&lt;/wbr&gt;**

**&lt;wbr&gt;？&lt;/wbr&gt;**

**21**

**width**

&lt;wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;按钮图片的长度。默认 110&lt;/wbr&gt;

**22**

**height**

**&lt;wbr&gt;&lt;/wbr&gt;**

&lt;wbr&gt;按钮图片的高度。默认 30&lt;/wbr&gt;

**23**

**wmode**

**&lt;wbr&gt;&lt;/wbr&gt;**

&lt;wbr&gt;背景透明transparent 与不透明opaque设定。默认 不透明&lt;/wbr&gt;

**&lt;wbr&gt;&lt;/wbr&gt;**

**24**

**cancelImg**

**&lt;wbr&gt;&lt;/wbr&gt;**

&lt;wbr&gt;取消按钮。设定图片路径。默认cancel.png&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**25**

**onInit**

**&lt;wbr&gt;&lt;/wbr&gt;**

函数， 初始化时的状态。

onInit: function() {&lt;wbr&gt;&lt;/wbr&gt;

$("#id").html("上传前");},

**26**

**onComplete**

**&lt;wbr&gt;&lt;/wbr&gt;**

[**函数：可传递五个参数**]()

**event:** 事件对象

**queueID:** 完成文件的唯一标识符。

**fileObj:** &lt;wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;name&lt;/strong&gt; – 文件名&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;filepath&lt;/strong&gt; –上传路径&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;size&lt;/strong&gt; – 文件大小&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;creationDate&lt;/strong&gt; – 文件创建时间&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;modificationDate&lt;/strong&gt; –&lt;a name="OLE\_LINK9"&gt;&lt;/a&gt;&lt;a name="OLE\_LINK8"&gt;文件最近修改时间&lt;/a&gt;&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;type&lt;/strong&gt; –文件的扩展名&lt;/wbr&gt;

response**:** 服务器回调的数据

data**:** &lt;wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;fileCount&lt;/strong&gt; – The total number of files left in the queue&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;speed&lt;/strong&gt; – 平均上传速度 KB/s&lt;/wbr&gt;

**如：**

**onComplete**: function(event, queueID, fileObj) {

&lt;wbr&gt; alert("文件:" +fileObj.name + "上传失败");&lt;wbr&gt;&lt;wbr&gt;}&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**27**

**onSelectOnce**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递二个参数**

**event:** The event object.

**data:** An object containing details about the select operation.

&lt;wbr&gt; • &lt;strong&gt;fileCount&lt;/strong&gt; – The total number of files in the queue&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;filesSelected&lt;/strong&gt; – The number of files selected in the select operation&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;filesReplaced&lt;/strong&gt; – The number of files that were replaced in the queue&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;allBytesTotal&lt;/strong&gt; – The total number of bytes for all files in the queue&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**28**

**onCancel**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递四个参数**

**event:** The event object.

**queueID:** The unique identifier of the file that was cancelled.

**fileObj:** An object containing details about the file that was selected.

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;name&lt;/strong&gt; – The name of the file&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;size&lt;/strong&gt; – The size in bytes of the file&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;creationDate&lt;/strong&gt; – The date the file was created&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;modificationDate&lt;/strong&gt; – The last date the file was modified&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;type&lt;/strong&gt; – The file extension beginning with a '.'&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**data:** Details about the file queue.

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;fileCount&lt;/strong&gt; – The total number of files left in the queue&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;wbr&gt; • &lt;strong&gt;allBytesTotal&lt;/strong&gt; – The total number of bytes left for all files in the queue&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**29**

**onClearQueue**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递一个参数**

**event:** The event object.

**30**

**onQueueFull**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递二个参数**

• **event** - The event object.

• **queueSizeLimit** - The maximum size of the queue.

**&lt;wbr&gt;&lt;/wbr&gt;**

**31**

**onError**

**&lt;wbr&gt;&lt;/wbr&gt;**

[]()[]()[**函数：可传递四个参数**]()

**&lt;wbr&gt;&lt;/wbr&gt;**

**event**: The event object.

**queueID:** The unique identifier of the file that was errored.

**fileObj:** An object containing details about the file that was selected.

&lt;wbr&gt; • &lt;strong&gt;name&lt;/strong&gt; – The name of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;size&lt;/strong&gt; – The size in bytes of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;creationDate&lt;/strong&gt; – The date the file was created&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;modificationDate&lt;/strong&gt; – The last date the file was modified&lt;/wbr&gt;

&lt;wbr&gt;&lt;strong&gt;• type&lt;/strong&gt; – The file extension beginning with a '.'&lt;/wbr&gt;

errorObj: An object containing details about the error returned.

&lt;wbr&gt;&lt;strong&gt;• type&lt;/strong&gt; – Either 'HTTP', 'IO', or 'Security'&lt;/wbr&gt;

&lt;wbr&gt;&lt;strong&gt;• info&lt;/strong&gt; – An error message describing the type of error returned&lt;/wbr&gt;

**&lt;wbr&gt;&lt;/wbr&gt;**

**32**

**onOpen**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递三个参数**

**event:** The event object.

**queueID:** The unique identifier of the file that was opened.

**fileObj:** An object containing details about the file that was selected.

&lt;wbr&gt; • &lt;strong&gt;name&lt;/strong&gt; – The name of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;size&lt;/strong&gt; – The size in bytes of the file&lt;/wbr&gt;

&lt;wbr&gt; •&lt;wbr&gt;&lt;strong&gt;creationDate&lt;/strong&gt; – The date the file was created&lt;/wbr&gt;&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;modificationDate&lt;/strong&gt; – The last date the file was modified&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;type&lt;/strong&gt; – The file extension beginning with a '.'&lt;/wbr&gt;

**&lt;wbr&gt;&lt;/wbr&gt;**

**33**

**onProgress**

**&lt;wbr&gt;&lt;/wbr&gt;**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递四个参数**

**event:** The event object.

**queueID:** The unique identifier of the file that was updated.

**fileObj:** An object containing details about the file that was selected.

&lt;wbr&gt; • &lt;strong&gt;name&lt;/strong&gt; – The name of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;size&lt;/strong&gt; – The size in bytes of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;creationDate&lt;/strong&gt; – The date the file was created&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;modificationDate&lt;/strong&gt; – The last date the file was modified&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;type&lt;/strong&gt; – The file extension beginning with a '.'&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**data:** An object containing details about the upload and queue.

&lt;wbr&gt; • &lt;strong&gt;percentage&lt;/strong&gt; – The current percentage completed for the upload&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;bytesLoaded&lt;/strong&gt; – The current amount of bytes uploaded&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;allBytesLoaded&lt;/strong&gt; – The current amount of bytes loaded for all files in the queue&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;speed&lt;/strong&gt; – The current upload speed in KB/s&lt;/wbr&gt;

**&lt;wbr&gt;&lt;/wbr&gt;**

**34**

**onSelect**

**&lt;wbr&gt;&lt;/wbr&gt;**

**&lt;wbr&gt;&lt;/wbr&gt;**

**event:** The event object.

**queueID:** The unique identifier of the file that was selected.

**fileObj:** An object containing details about the file that was selected.

&lt;wbr&gt; • &lt;strong&gt;name&lt;/strong&gt; – The name of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;size&lt;/strong&gt; – The size in bytes of the file&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;creationDate&lt;/strong&gt; – The date the file was created&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;modificationDate&lt;/strong&gt; – The last date the file was modified&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;type&lt;/strong&gt; – The file extension beginning with a '.'&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**35**

**onAllComplete**

**&lt;wbr&gt;&lt;/wbr&gt;**

**&lt;wbr&gt;&lt;/wbr&gt;**

[**函数：可传递二个参数**]()

**&lt;wbr&gt;&lt;/wbr&gt;**

**event:** The event object.

**data:** An object containing details about the upload process.

&lt;wbr&gt; • &lt;strong&gt;filesUploaded&lt;/strong&gt; – The total number of files uploaded&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;errors&lt;/strong&gt; – The total number of errors while uploading&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;allbytesLoaded&lt;/strong&gt; – The total number of bytes uploaded&lt;/wbr&gt;

&lt;wbr&gt; • &lt;strong&gt;speed&lt;/strong&gt; – The average speed of all uploaded files&lt;/wbr&gt;

&lt;wbr&gt;&lt;/wbr&gt;

**36**

**onCheck**

**&lt;wbr&gt;&lt;/wbr&gt;**

**函数：可传递五个参数**

**&lt;wbr&gt;&lt;/wbr&gt;**

**event:** The event object.

**checkScript:** The path to the file checking script.

**fileQueue:** A file queue object consisting of&lt;wbr&gt; key/value pairs with the queue ID as the key and the filename as the value.&lt;/wbr&gt;

**folder:** The path to the upload folder.

**single:** True if only one file is being uploaded from the queue.