最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

uploadify教程

来源:动视网 责编:小OO 时间:2025-09-28 19:38:18
文档

uploadify教程

Uploadify使用说明什么是Uploadify原文:UploadifyisajQuerypluginthatintegratesafully-customizablemultiplefileuploadutilityonyourwebsite.ItusesamixtureofJavascript,ActionScript,andanyserver-sidelanguagetodynamicallycreateaninstanceoveranyDOMelementonapage.译文:Upl
推荐度:
导读Uploadify使用说明什么是Uploadify原文:UploadifyisajQuerypluginthatintegratesafully-customizablemultiplefileuploadutilityonyourwebsite.ItusesamixtureofJavascript,ActionScript,andanyserver-sidelanguagetodynamicallycreateaninstanceoveranyDOMelementonapage.译文:Upl
Uploadify使用说明

什么是Uploadify

原文:Uploadify is a jQuery plugin that integrates a fully-customizable multiple file upload utility on your website. It uses a mixture of Javascript, ActionScript, and any server-side language to dynamically create an instance over any DOM element on a page.

译文:Uploadify是一个jQuery插件,集成了一个完全可定制的多个文件上传您的网站上的效用。它混合使用的Javascript,ActionScript,和任何服务器端语言来动态创建的任何一个页面上的DOM元素的一个实例。

原文: Uploadify was born out of the need for a multiple file upload utility for a CMS that was being developed.  After evaluating the other available options, RonnieSan decided the best option was to build a new plug-in and make it available to the development community.  In order to make the plug-in easy to implement and highly-customizable, the jQuery format was chosen.  After word got out, the popularity of the plug-in spawned the need for a dedicated site.  Travis Nickels volunteered his help to refine the Uploadify plug-in and make it what it is today.

译文:CMS开发后,需要实现多文件上传功能,这样,Uploadify这个实用工具诞生了。经过评过其他可用选项,RonnieSan决定创建一个新的插件提供给开发社区。为了使这个插件容易实施,并可高度定制,最后选择了Jquery.消息传出后,这个插件的普及,使其需要一个专门的网站来提供支持。Travis Nickels自告奋勇的去帮助和完善Uploadify插件。这就是我们今天看到的这个网站。

Uplodify的特点

Features特点
∙jQuery Implementation

Jquery支持

∙Multiple File Upload Capabilities

多文件上传功能
∙SWFObject Integration

SWFObject集成

∙Compatibility with Popular Server-Side Languages

流行的服务器端语言功能
∙Highly-Customizable

高定制性
∙Large Support Community

强大的社区支持
∙Extensive Documentation with Examples

扩展文档和实例
怎么使用Uploadify

原文:Uploadify was created to be an easy-to-implement solution for multiple file uploads. As a jQuery plugin, the Uploadify implementation is simple and highly-customizable.

While it may require a foundational knowledge of jQuery to successfully implement, this documentation should provide a comprehensive enough reference for those who are having trouble.  If you are running into issues that this documentation can't help solve, there is an active community of Uploadify users that can be accessed through the forums.  In addition, we've provided a list of FAQs that may also aid in troubleshooting your Uploadify instance

译文:

Uploadify是一个简单易用的多文件上传方案。作为一个Jquery插件,Uploadify使用简单,并具有高度的定制性。

正常使用Uploadify插件需要一些Jquery基础知识。为了减少使用问题,本文档提供了足够全面的参考知识。如果该文档不能解决你在使用中遇到的问题,请访问论坛(http://www.uploadify.com/forums/)获取更多信息。此外,我们提供了常见问题列表,也许这些信息也能帮助你解决Uploadify在使用中遇到的问题。

最低需求
jQuery 1.4.x or greaterJquery1.4及更高版本
swfObject 2.2 or greaterSwfObject2.2及以上版本
Flash Player 9.0.24 or greaterFlash Player 9.0.24及以上版本
示例代码

头文件引入

使用Uploadify插件需要引入uploadify.css、jquery.js、swfobjects.js、和uploadify.js等4个文件

HTML文件

如果只是实现简单的文件上传功能,只需要在body里,添加一个file。

Js代码

        $(document).ready(function () {

            $("#up_file").uploadify({

                'uploader': '/uploadify/uploadify/uploadify.swf',

                'script': '/uploadify/UploadifyHandler.ashx',

                'cancelImg': ,

                'folder': '/upload',

                'auto':true,

                'multi':true

            });

        });

    

Ok,以上文件就可以实现一个文件上传功能。

        

属性
名称类型描述
autoboolean文件添加到上传队列后,自动进行上传。默认为false
buttonImgstring浏览按钮的图片路径
buttonTextstring浏览按钮上显示的文字(不支持中文,但是可以设置有中文的图片)
cancelImgstring文件上传队列中的取消按钮图片路径
checkScriptstring检测服务器上已经存在的文件的服务器端脚本路径
displayDatastring文件上传过程中,在该文件的队列条目显示的数据信息。默认是上传的百分比(percentage),你可以改为”speed”,显示文件上传的平均速度。
expressInstallstringexpressInstall.swf 的文件路径,如果计算机不存在flash,则使用该选项初始化flash。
fileDataNamestring服务器端脚本使用的文件数组名称。默认为Filedata
fileDescstring1.该选项必须配合fileExt一起使用,他是文件类型选中显示的内容,例如: 

2.'fileExt'     : ,

3. 'fileDesc'    : 'Web Image Files (.JPG, .GIF, .PNG)'

fileExtstring允许上传的文件类型,使用分号(”;)”分割 例如默认为null(所有文件类型)
folderstring上传的文件保存路径(文件夹目录)
heightinteger浏览按钮的高度
hideButtonboolean隐藏flash按钮,这样你就可以自己设置底层div元素的样式了
methodstring提交方式POST 和GET,默认是POST
multiboolean是否允许多文件上传。默认为false
queueIDstring页面上作为文件上传队列的元素的ID
queueSizeLimitinteger允许上传的文件数量上限.默认是999
removeCompletedboolean文件上传完成后,是否自动移除队列中的文件。默认为true
rolloverboolean如果设置为true,则鼠标移到浏览按钮上后,会有翻转效果
scriptstring服务器端处理文件上传的脚本路径
scriptAccessstringflash脚本文件的访问模式,如果在本地测试设置为always.允许的选项: 'sameDomain' / 'always',默认是sameDomain.
scriptDataJSON object with mixed types在文件上传的过程中,scriptData选项允许发送额外的数据到服务器端脚本,你能像正常使用提交方式获取值(request.Form[“scriptData variable”])。同时,结合.uploadifySettings()方法,可以发送动态数据。

例如: 'scriptData'  : {'firstName':'Ronnie','age':30}

simUploadLimitinteger同时上传文件的数量。默认为1
sizeLimitinteger允许上传的文件大小(kb), 例如: 'sizeLimit'   : 102400
uploaderstringUploadify.swf文件路径
widthstring浏览按钮的宽度
wmodeString 设置该项为transparent 可以使浏览按钮的flash背景文件透明,并且flash文件会被置为页面的最高层。 默认值:opaque 
事件
onAllCompletefunction当队列中所有文件上传完成后触发。

function(event,data) 

onCancelfunction当队列中的每个文件别移除时触发
onCheckfunction上传开始前,如果发现有同名的文件存在则触发该事件。
onClearQueuefunction当uploadifyClearQueue()方法调用时触发
onCompletefunction当单个文件上传完成后触发
onErrorfunction当单个文件上传出错时触发
onInitfunction当uploadify实例加载时触发
事件

1、onAllComplete:当队列中所有文件上传完成后触发。

示例

‘onAllComplete’:function(event,data){….}

event:事件对象(the event object)

data:包含上传文件的详细信息对象

Data

数据对象
filesUploaded上传了的文件的数量
errors遇到的错误总数
allBytesLoaded上传的总字节数
speed平均上传速度(kb/s)
2、onCancel:当队列中的每个文件别移除时触发

示例

‘onCancel’:function(event,ID,fileObj,data){…}

event:事件对象(the event object)

ID:被取消的文件的唯一标识

fileObj:选中文件的对象,他包含的属性列表如下

FileOjb

属性
name文件名
size文件大小(byte)
creationDate文件的创建日期
modifiedDate文件最后一次修改日期
type文件的扩展名<包含’.’>
data:文件队列详细信息

data

属性
fileCount队列中剩余文件的数量
allBytesTotal队列中剩余文件的大小(byte)
3、onCheck: 上传开始前,如果发现有同名的文件存在则触发该事件。

示例:function(event,data,key){。。}

event:事件对象(the event object)

data:包含服务器段所有文件名称的一个列表。每个文件的关键字是队列中的唯一标识。

key:用户服务器段检测的唯一标识

4、onClearQueue: 当uploadifyClearQueue()方法调用时触发

示例:’onClearQueue’:function(event){….}

event:事件对象(the event object)

5、onComplete:当单个文件上传完成后触发

示例:’onComplete’:function(event,ID,fileObj,response,data){….}

event:事件对象(the event object)

ID:该文件在文件队列中的唯一表示

fileObj:选中文件的对象,他包含的属性列表如下

FileOjb

属性
name文件名
filePath上传服务器后的文件路径
size文件大小(byte)
creationDate文件的创建日期
modifiedDate文件最后一次修改日期
type文件的扩展名<包含’.’>
response:服务器端返回的Response文本

data:文件队列详细信息和文件上传的一般数据

data

属性
fileCount队列中剩余文件的数量
Speed上传文件的平均速度(byte)
6、onError:当单个文件上传出错时触发

示例:’onError’:function(event,ID,fileObj,errorObj){…}

event:事件对象(the event object)

fileObj:选中文件的对象,他包含的属性列表如下

FileOjb

属性
name文件名
size文件大小(byte)
creationDate文件的创建日期
modifiedDate文件最后一次修改日期
type文件的扩展名<包含’.’>
errorObj:返回的错误信息对象

errorObj

属性
typeHTTP/IO/ Security 之一
info描述返回错误类型的信息。
7、onInit: 当uploadify实例加载时触发

示例:’onInit’:function(){…}

8、onOpen:文件开始上传时触发

示例:’onOpen’:function(event,ID,fileObj){…}

event:事件对象(the event object)

ID:开始上传的文件在文件队列中的唯一表示

fileObj:选中文件的对象,他包含的属性列表如下

FileOjb

属性
name文件名
size文件大小(byte)
creationDate文件的创建日期
modifiedDate文件最后一次修改日期
type文件的扩展名<包含’.’>
9、onProgress: 点击上传时触发,如果auto设置为true则是选择文件时触发,如果有多个文件上传则遍历整个文件队列,在onOpen之后触发。

示例:’onProgress’:function(event,ID,fileObj,data){…}

event:事件对象(the event object)

ID:正在上传的文件在文件队列中的唯一表示

fileObj:选中文件的对象,他包含的属性列表如下

FileOjb

属性
name文件名
size文件大小(byte)
creationDate文件的创建日期
modifiedDate文件最后一次修改日期
type文件的扩展名<包含’.’>
data:上传和队列的信息对象。

data

属性
percentage文件上传的百分比
bytesLoaded已经上传的字节数
allBytesLoaded整个队列中上传的字节数
speed上传文件的平均速度(byte)
10、onQueueFull: 当设置了queueSizeLimit并且选择的文件个数超出了queueSizeLimit的值时触发

示例:’onQueueFull’:function(event,queueSizeLimit){}

event:事件对象(the event object)

queueSizeLimit:上传文件的最大数。queueSizeLimit属性值。

11、onSelect: 选择文件时触发,

示例:’onSelect’:function(event,ID,fileObj){…}

event:事件对象(the event object)

ID:选中文件的唯一标识

fileObj:选中文件的对象,他包含的属性列表如下

FileOjb

属性
name文件名
size文件大小(byte)
creationDate文件的创建日期
modifiedDate文件最后一次修改日期
type文件的扩展名<包含’.’>
12、onSelectOnce: 在单文件或多文件上传时,选择文件时触发。

示例:’onSelectOnce’:function(event,data){…}

event:事件对象(the event object)

data:选择的操作信息

data

属性
fileCount队列中的文件数量
filesSelected选择文件操作中选中的文件数量
filesReplaced队列中被替换的文件数量
allBytesTotal整个队列中上传的字节数
13、onSWFReady:当flash文件加载时触发

示例:’onSWFReady’:function(){}

方法

∙uploadify() 创建一个uploadify实例。

∙uploadifyCancel() 从队列中移除一个文件。如果文件正在上传,则停止上传,并在队列中移除该文件。uploadifyCancel($(“. uploadifyQueueItem”).first().attr(“id”).replace(“页面上的file的ID”,””));

∙uploadifyClearQueue():取消文件上传,并移除队列中的所有文件。

∙uploadifySettings():更改uploadify初始化时的选项uploadifySettings(‘buttonText’,’Browse’)

∙uploadifyUpload()上传文件:uploadifyUpload($(“. uploadifyQueueItem”).first().attr(“id”).replace(“页面上的file的ID”,’’));

备注:由于官方给出的文件上传用的是PHP语言文件。所以自己写了一个.net的

附录

∙Uploadify的官方网站: http://www.uploadify.com/

∙Uploadify的下载页面: http://www.uploadify.com/download/

∙Uploadify-V2.1.4 :http://www.uploadify.com/wp-content/uploads/uploadify-v2.1.4.zip

∙帮助文档: http://www.uploadify.com/documentation/

∙常见问题: http://www.uploadify.com/faqs/

∙Demo下载地址: http://dl.dbank.com/c08qsci31i

文档

uploadify教程

Uploadify使用说明什么是Uploadify原文:UploadifyisajQuerypluginthatintegratesafully-customizablemultiplefileuploadutilityonyourwebsite.ItusesamixtureofJavascript,ActionScript,andanyserver-sidelanguagetodynamicallycreateaninstanceoveranyDOMelementonapage.译文:Upl
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top