2023-05-12 开启多语言插件支持……

uploadify 返回值(回调函数)总结

jquery 苏 demo 3167℃ 0评论

uploadify 返回值(回调函数)总结:

$(function() {
    $('#file_upload').uploadify({
        'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
            'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
        },
        'swf'      : './uploadify.swf',
        'uploader' : './uploadify.php',
        //'uploader' : 'http://s.v9.com/getpic/upload.php',
        'debug':true,
        'scriptData': { 'key': '123' },
        'multi'       : true,
        'onComplete'  : function(event, ID, fileObj, response, data) {
        //alert('There are ' + data.fileCount + ' files remaining in the queue.');
        alert('qerew');
    },
        'onUploadSuccess':function(file,data,response){
        alert('123');
    }
    });
});

注意:第17,18行,这两行就是接收返回值的,返回值在data里面

使用示例代码:

<script>
    $('#file_upload').uploadify({
        'swf'      : '/Public/js/uploadify.swf',
        'uploader' : "{:U('Users/avatar')}",
        'buttonText' : '上传头像',
        'onUploadSuccess' : function(file,data,response) {
            var obj = eval('('+data+')');
            if(obj.status == 1){
                $('#avatar').attr('src',obj.result);
                $('#avatar_input').val(obj.result);
            }
            else{
                alert(obj.result);
                return false;
            }
        }
    });
</script>

 

打赏

转载请注明:苏demo的别样人生 » uploadify 返回值(回调函数)总结

   如果本篇文章对您有帮助,欢迎向博主进行赞助,赞助时请写上您的用户名。
支付宝直接捐助帐号oracle_lee@qq.com 感谢支持!
喜欢 (0)or分享 (0)