swfupload 的代码

  2, 要在前台页面里调用这两个js,然后初始化swfu对象。 折叠展开JavaScript复制代码
<script type="text/javascript">   
var swfu;   
window.onload = function () {   
    swfu = new SWFUpload({   
    // Backend Settings   
    upload _url: "upload .asp ",    // Relative to the SWF file 就是这个地方误导了我   
    file_post_name: "Filedata",  // 文件对象的名称,默认Filedata,可以自己改.后台接收就靠它识别   
    post_params: {"SESSID" : "<%=session.SessionID%>"},  // 附加参数,版本2新功能   
 
    // File Upload Settings   
    file_size_limit : "204",    // 单位kb, 限制文件大小   
    file_types : "*.jpg",  //允许的文件类型   
    file_types_description : "JPG Images", //对话框里的文件类型   
    file_upload _limit : "0",   
 
    // Event Handler Settings - these functions as defined in Handlers.js   
    //  The handlers are not part of SWFUpload but are part of my website and control how   
    //  my website reacts to the SWFUpload events.   
    //  事件处理,可以自己在handlers.js里面扩充,极大的方便了开发者   
    //  就是要在handlers里面定义如下的function,当然function里面可以什么也不干,或者用源代码自带的也行   
    file_queue_error_handler : fileQueueError,   
    file_dialog_complete_handler : fileDialogComplete,   
    upload _progress_handler : uploadProgress,   
    upload _error_handler : uploadError,   
    upload _success_handler : uploadSuccess,   
    upload _complete_handler : uploadComplete,   
 
    // Flash Settings   
    flash_url : "js/swfupload_f9.swf ",    // Relative to this file 注意是f8还是f9   
 
    custom_settings : {   
        upload _target : "divFileProgressContainer" 
    },   
       
    // Debug Settings 是否打开调试信息,默认false   
    debug: true 
    });   
}   
</script> 


 

如果flash_url用的是f8.swf ,那么upload _url要使用相对SWF 的路径;如果用的是f9.swf ,那么upload _url 要使用相对当前程序页面(jsp,asp )的路径,就是这点,耽误了我很长时间. 如果要使用server_data传递返回值,也必须用f9.swf ,这点也花了我不少时间. 不管怎样,su都提供的全部源代码,有问题可以自己研究,前提是你能像我一样看的懂,呵呵.

      su使用的是flash的上传功能(Flash.net.FileReference;),还用了ActionScript 和 Flash Player 的容器之间实现直接通讯的应用程序编程接口ExternalInterface(详见后文附录),


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/pp990d0ds

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值