tp5使用uploadify插件做上传

uploadify插件地址
推荐使用flash版本

插件引入
<script src="../jquery.js"></script>
<script src="../jquery.uploadify.min.js"></script>
<script type="text/javascript">
$(function(){
$("#uploadify").uploadify({
'swf': 'ADMIN/plus/uploadify/uploadify.swf',//所需要的flash文件

             'uploader': "{:url('Cate/upImg')}",//实现上传的程序
             'progressData':'speed',//设置上传进度显示方式,percentage显示上传百分比,speed显示上传速度
             'fileTypeDesc'   : '支持格式:*.jpg;*.jpeg;*.gif;*.png',
             'fileTypeExts': '*.jpg;*.jpeg;*.gif;*.png',//可上传的文件类型

             'buttonText' :'文件上传',//通过文字替换钮扣上的文字
             'buttonClass':'btn btn-xs btn-purple',
             'fileObjName':'img',//文件上传对象的名称,如果命名为’the_files’,PHP程序可以用$_FILES['the_files']来处理上传的文件对象。
             'onUploadSuccess':function(file,data,response){
                            //上传成功后的回调函数
                            var cateImgSrc = "__ROOT__/uploads/cateimg/"+data;

                            var cateimg = "<img height='50' src='"+cateImgSrc+"' >";
                            $('#cateimg').html(cateimg);
                            $("input[name='img']").val(data);
                            if($("input[name='img']").val()!=''){
                                $("#cateimg p").remove();
                            }
                         },
                                         'onSelectError':function(file, errorCode, errorMsg){

                                     switch(errorCode) {
                                         case -110:
                                            layer.alert("图像大小超限,请调低像素后重新上传", {icon: 2});
                                             break;
                                         case -120:
                                            layer.alert("文件 ["+file.name+"] 大小异常!", {icon: 2});
                                             break;
                                         case -130:
                                            layer.alert("文件 ["+file.name+"] 类型不正确!", {icon: 2});
                                             break;
               }}
             });
                 })