Jquery uploadify插件可选参数的详细介绍
以下是可选项的参数说明:(红色的属性代表常用的)
<wbr></wbr>
1
uploader
上传控件的主体文件,flash控件
<wbr><wbr> 默认值='uploadify.swf'</wbr></wbr>
2
script
<wbr></wbr>
相对路径的后端脚本,它将处理您上传的文件。
绝对路径前缀或'/'或'http'的路径
<wbr> 默认值='uploadify.php'</wbr>
3
checkScript
<wbr></wbr>
检查该文件是否已经选择驻留在服务器上。
没有默认值。 官方例子中'check.php'是提供核心文件
4
scriptData
<wbr></wbr>
可提供URL传递参数。用来传递get参数。例如:
<wbr> index.jsp?id=1&action=uploadify可以设置成:</wbr>
'script': 'index.jsp',
'scriptData':{'id':1,'action':'uploadify'},
注:要设置‘method’:‘GET’.
<wbr></wbr>
5
fileDataName
<wbr></wbr>
<wbr>您的文件在上传服务器脚本阵列的名称。<br><wbr><wbr> 默认值='Filedata'</wbr></wbr></wbr>
6
method
<wbr></wbr>
<wbr>设置为发送到后端脚本的方法。要么'get'或post'。</wbr>
<wbr><wbr> 默认值'post'</wbr></wbr>
7
scriptAccess
<wbr></wbr>
<wbr>?</wbr>
8
folder
<wbr></wbr>
您想将文件保存到的路径。考虑到安全问题,一般并不在客户端设定后供服务器得到所存的路径。我试了下。这个参数好像以get的方式传递的。设定post得不到这个值。
9
queueID
<wbr></wbr>
<wbr>文件队列ID。与div的id一致。</wbr>
10
queueSizeLimit
<wbr></wbr>
限制在一次队列中的次数(可选定几个文件)。默认值= 999,而一次可传几个文件有 simUploadLimit属性决定。
11
multi
<wbr></wbr>
是否允许同时上传多文件,可设定true或false。
<wbr> 默认false。设定true时,选中的文件是当前项。</wbr>
12
auto
<wbr></wbr>
选定文件后是否自动上传,可设定true或false。
<wbr> 默认false</wbr>
13
fileDesc
<wbr></wbr>
出现在上传对话框中的文件类型描述。与fileExt需同时使用
14
fileExt
<wbr></wbr>
支持的格式,启用本项时需同时声明fileDesc。
如:‘*.rar,*.doc
<wbr></wbr>
15
sizeLimit
<wbr></wbr>
控制上传文件的大小,单位byte
16
simUploadLimit
<wbr></wbr>
多文件上传时,同时上传文件数目限制。默认1
<wbr> 一次可传几个文件。</wbr>
17
buttonText
<wbr></wbr>
默认按钮的名字。默认BROWER
18
buttonImg
<wbr></wbr>
使用图片按钮,设定图片的路径即可。
19
hideButton
<wbr></wbr>
上传按钮的隐藏。true 或false。默认flase
20
rollover
<wbr></wbr>
<wbr>?</wbr>
21
width
<wbr></wbr>
<wbr>按钮图片的长度。默认 110</wbr>
22
height
<wbr></wbr>
<wbr>按钮图片的高度。默认 30</wbr>
23
wmode
<wbr></wbr>
<wbr>背景透明transparent 与不透明opaque设定。默认 不透明</wbr>
<wbr></wbr>
24
cancelImg
<wbr></wbr>
<wbr>取消按钮。设定图片路径。默认cancel.png</wbr>
<wbr></wbr>
<wbr></wbr>
25
onInit
<wbr></wbr>
函数, 初始化时的状态。
onInit: function() {<wbr></wbr>
$("#id").html("上传前");},
26
onComplete
<wbr></wbr>
函数:可传递五个参数
event: 事件对象
queueID: 完成文件的唯一标识符。
fileObj: <wbr></wbr>
<wbr> • <strong>name</strong> – 文件名</wbr>
<wbr> • <strong>filepath</strong> –上传路径</wbr>
<wbr> • <strong>size</strong> – 文件大小</wbr>
<wbr> • <strong>creationDate</strong> – 文件创建时间</wbr>
<wbr> • <strong>modificationDate</strong> –<a name="OLE_LINK9"></a><a name="OLE_LINK8">文件最近修改时间</a></wbr>
<wbr> • <strong>type</strong> –文件的扩展名</wbr>
response**:** 服务器回调的数据
data**:** <wbr></wbr>
<wbr> • <strong>fileCount</strong> – The total number of files left in the queue</wbr>
<wbr> • <strong>speed</strong> – 平均上传速度 KB/s</wbr>
如:
onComplete: function(event, queueID, fileObj) {
<wbr> alert("文件:" +fileObj.name + "上传失败");<wbr><wbr>}</wbr></wbr></wbr>
<wbr></wbr>
27
onSelectOnce
<wbr></wbr>
函数:可传递二个参数
event: The event object.
data: An object containing details about the select operation.
<wbr> • <strong>fileCount</strong> – The total number of files in the queue</wbr>
<wbr> • <strong>filesSelected</strong> – The number of files selected in the select operation</wbr>
<wbr> • <strong>filesReplaced</strong> – The number of files that were replaced in the queue</wbr>
<wbr> • <strong>allBytesTotal</strong> – The total number of bytes for all files in the queue</wbr>
<wbr></wbr>
28
onCancel
<wbr></wbr>
函数:可传递四个参数
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.
<wbr><wbr> • <strong>name</strong> – The name of the file</wbr></wbr>
<wbr><wbr> • <strong>size</strong> – The size in bytes of the file</wbr></wbr>
<wbr><wbr> • <strong>creationDate</strong> – The date the file was created</wbr></wbr>
<wbr><wbr> • <strong>modificationDate</strong> – The last date the file was modified</wbr></wbr>
<wbr><wbr> • <strong>type</strong> – The file extension beginning with a '.'</wbr></wbr>
<wbr></wbr>
data: Details about the file queue.
<wbr><wbr> • <strong>fileCount</strong> – The total number of files left in the queue</wbr></wbr>
<wbr><wbr> • <strong>allBytesTotal</strong> – The total number of bytes left for all files in the queue</wbr></wbr>
<wbr></wbr>
29
onClearQueue
<wbr></wbr>
函数:可传递一个参数
event: The event object.
30
onQueueFull
<wbr></wbr>
函数:可传递二个参数
• event - The event object.
• queueSizeLimit - The maximum size of the queue.
<wbr></wbr>
31
onError
<wbr></wbr>
函数:可传递四个参数
<wbr></wbr>
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.
<wbr> • <strong>name</strong> – The name of the file</wbr>
<wbr> • <strong>size</strong> – The size in bytes of the file</wbr>
<wbr> • <strong>creationDate</strong> – The date the file was created</wbr>
<wbr> • <strong>modificationDate</strong> – The last date the file was modified</wbr>
<wbr><strong>• type</strong> – The file extension beginning with a '.'</wbr>
errorObj: An object containing details about the error returned.
<wbr><strong>• type</strong> – Either 'HTTP', 'IO', or 'Security'</wbr>
<wbr><strong>• info</strong> – An error message describing the type of error returned</wbr>
<wbr></wbr>
32
onOpen
<wbr></wbr>
函数:可传递三个参数
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.
<wbr> • <strong>name</strong> – The name of the file</wbr>
<wbr> • <strong>size</strong> – The size in bytes of the file</wbr>
<wbr> •<wbr><strong>creationDate</strong> – The date the file was created</wbr></wbr>
<wbr> • <strong>modificationDate</strong> – The last date the file was modified</wbr>
<wbr> • <strong>type</strong> – The file extension beginning with a '.'</wbr>
<wbr></wbr>
33
onProgress
<wbr></wbr>
<wbr></wbr>
函数:可传递四个参数
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.
<wbr> • <strong>name</strong> – The name of the file</wbr>
<wbr> • <strong>size</strong> – The size in bytes of the file</wbr>
<wbr> • <strong>creationDate</strong> – The date the file was created</wbr>
<wbr> • <strong>modificationDate</strong> – The last date the file was modified</wbr>
<wbr> • <strong>type</strong> – The file extension beginning with a '.'</wbr>
<wbr></wbr>
data: An object containing details about the upload and queue.
<wbr> • <strong>percentage</strong> – The current percentage completed for the upload</wbr>
<wbr> • <strong>bytesLoaded</strong> – The current amount of bytes uploaded</wbr>
<wbr> • <strong>allBytesLoaded</strong> – The current amount of bytes loaded for all files in the queue</wbr>
<wbr> • <strong>speed</strong> – The current upload speed in KB/s</wbr>
<wbr></wbr>
34
onSelect
<wbr></wbr>
<wbr></wbr>
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.
<wbr> • <strong>name</strong> – The name of the file</wbr>
<wbr> • <strong>size</strong> – The size in bytes of the file</wbr>
<wbr> • <strong>creationDate</strong> – The date the file was created</wbr>
<wbr> • <strong>modificationDate</strong> – The last date the file was modified</wbr>
<wbr> • <strong>type</strong> – The file extension beginning with a '.'</wbr>
<wbr></wbr>
35
onAllComplete
<wbr></wbr>
<wbr></wbr>
函数:可传递二个参数
<wbr></wbr>
event: The event object.
data: An object containing details about the upload process.
<wbr> • <strong>filesUploaded</strong> – The total number of files uploaded</wbr>
<wbr> • <strong>errors</strong> – The total number of errors while uploading</wbr>
<wbr> • <strong>allbytesLoaded</strong> – The total number of bytes uploaded</wbr>
<wbr> • <strong>speed</strong> – The average speed of all uploaded files</wbr>
<wbr></wbr>
36
onCheck
<wbr></wbr>
函数:可传递五个参数
<wbr></wbr>
event: The event object.
checkScript: The path to the file checking script.
fileQueue: A file queue object consisting of<wbr> key/value pairs with the queue ID as the key and the filename as the value.</wbr>
folder: The path to the upload folder.
single: True if only one file is being uploaded from the queue.