jquery上传插件uploadify3.1中文详细参考手册

756514656

贡献于2012-08-14

字数:0 关键词: 文件上传 手册

1. Uploadify 配置选项:  auto 类型:Boolen 缺省值:true 说明:表示在选择文件后是否自动上传  buttonClass 说明:额外增加的上传按钮样式类型  buttonCursor 说明:上传按钮 Hover 时的鼠标形状,默认值是’hand’  buttonImage 说明:按钮的背景图片,默认为 NULL  buttonText 说明:按钮上显示的文字,默认”SELECT FILES”  checkExisting 说明:默认是 false,若要检查可指明一个用于判断的脚本的路径,比如: ‘checkExisting’: ’/uploadify/check-exists.php’  debug 说明:开启 DEBUG 模式,默认 False  fileObjName 说明:文件对象名称。用于在服务器端获取文件。比如,把该属性设置 为’myFile’,那么在 PHP 中获取该文件的方法是:$_FILES[‘myFile’],该属 性的缺省值为:‘Filedata’  fileSizeLimit 说明:上传文件大小限制,默认单位是 KB,若需要限制大小在 100KB 以内, 可设置该属性为:’100KB’  fileTypeDesc 说明:文件类型的说明,比如设置该属性为:’Any Old file you want…’, 那么,选择文件时可以看到(图片右下角):  fileTypeExts 指定允许上传的文件类型。默认 *.*。比如只支持 gif , jpg , png 类型的图 像,那么该属性设置为: ‘*.gif; *.jpg ; *.png’  formData 指定上传文件附带的其他数据。也可以动态设置。下面看一个静态的例子: 其中,formData 中包含两个键值对,在服务器端可以通过$_POST 或者$_GET 获取这些数据。若要动态设置参数的值,可以通过 onUploadStart 方法,传入 参数”settings”如上图示,其把名为 someOtherKey 的变量的值改成了 2.  height 表示按钮的高度,默认 30PX。若要改为 50PX,如下设置: ‘height‘:50,  method 默认是’post’,也可以设置为’get’  multi 是否支持多文件上传,默认为 true  overrideEvents Uploadify 插件里面有一些事件,该参数意义就是设置哪些事件可以被用户 覆写。若进行如下设置: 表示 onUploadProgress 事件可以被用户自定义的事件覆盖。  preventCaching 若设置为 true,一个随机数将被加载 swf 文件 URL 的后面,防止浏览器缓 存。默认值为 true  progressData 设置文件上传时显示的数据,有两个选择:‘上传速度‘或者’百分比‘, 分别对应’speed’和’percentage’  queueID 表示上传队列的 DOM 元素的 ID 号,如下所示: 设置了 queueID 为 some_file_queue,那么选择多个文件上传后,就能看到实 时的队列情况,如下图所示:  queueSizeLimit 队列长度限制,缺省值 999  removeCompleted 表示在上传完成后是否删除队列中的对应元素。默认是 True,即上传完成后 就看不到上传文件进度条了。  removeTimeout 表示上传完成后多久删除队列中的进度条,默认为 3,即 3 秒。  requeueErrors 若设置为 True,那么在上传过程中因为出错导致上传失败的文件将被重新加 入队列。  successTimeout 表示文件上传完成后等待服务器响应的时间。超过该时间,那么将认为上传 成功。默认是 30,表示 30 秒。  swf swf 文件路径  uploader 服务器端脚本文件路径  uploadLimit 最多上传文件数量,默认 999  width 按钮宽度,默认 120 2. Uploadify 事件:  onCancel 在文件被移除出队列时触发  onClearQueue 在调用 cancel 方法且传入参数’*’时触发  onDestroy 调用 destroy 方法时触发  onDialogClose 打开文件对话框关闭时触发 参数 queueData 有以下属性: • filesSelected The number of files selected in browse files dialog • filesQueued The number of files added to the queue (that didn’t return an error) • filesReplaced The number of files replaced in the queue • filesCancelled The number of files that were cancelled from being added to the queue (not replaced) • filesErrored The number of files that returned an error  onDialogOpen 选择文件对话框打开时触发。  onDisable 禁用 Uploadify 时触发(通过 disable 方法)  onEnable 使能 Uploadift 时触发  onFallback 没有兼容的 FLASH 时触发  onInit 每次初始化一个队列时触发  onQueueComplete 在队列中的文件上传完成后触发  onSelect 选择文件后触发  onSelectError 选择文件后出错时触发。参数如下 • file The file object that returned the error. • errorCode The error code that was returned. The following constants can be used when determining the error code: • QUEUE_LIMIT_EXCEEDED – The number of files selected will push the size of the queue passed the limit that was set. • FILE_EXCEEDS_SIZE_LIMIT – The size of the file exceeds the limit that was set. • ZERO_BYTE_FILE – The file has no size. • INVALID_FILETYPE – The file type does not match the file type limitations that were set. • errorMsg The error message indicating the value of the limit that was exceeded. *You can access a full error message using ‘this.queueData.errorMsg’ if you do not override the default event handler.  onSWFReady FLASH 对象加载成功后触发  onUploadComplete 上传文件成功后触发(每一个文件都触发一次)  onUploadError 上传文件失败触发,参数如下: • file The file object that was uploaded • errorCode The error code that was returned • errorMsg The error message that was returned • errorString The human-readable error message containing all the details of the error  onUploadProgress 每个文件上传后更新一次进度信息。参数如下: • file The file object being uploaded • bytesUploaded The number of bytes of the file that have been uploaded • bytesTotal The total number of bytes of the file • totalBytesUploaded The total number of bytes uploaded in the current upload operation (all files) • totalBytesTotal The total number of bytes to be uploaded (all files)  onUploadStart 在一个文件开始上传之前触发。  onUploadSuccess 在每一个文件上传成功后触发 参数如下: • file The file object that was successfully uploaded • data The data that was returned by the server-side script (anything that was echoed by the file) • response The response returned by the server—true on success or false if no response. If false is returned, after the successTimeout option expires, a response of true is assumed. 3. Uploadify 方法:  cancel  destroy  disable  settings 参数  name The name of the setting you want to return or change. Only setting this argument will return the value.  value The value you would like to use for the setting.  resetObjects Set this to true when updating the postData object to erase existing values. Otherwise, new values will be added to existing ones. *The only setting that cannot be set is the swf setting.  stop 停止上传  upload 参数:fileID The ID of the file you would like to upload. The easiest way to get the fileID of a queue item is to use the id attribute of the queue item you want to upload. To upload multiple files, add each fileID as an argument. If ‘*’ is passed as the first and only argument, all files in the queue will be uploaded.

下载文档,方便阅读与编辑

文档的实际排版效果,会与网站的显示效果略有不同!!

需要 5 金币 [ 分享文档获得金币 ] 9 人已下载

下载文档

相关文档