Uploadify Multiple buttons - one page

后端 未结 4 1639
被撕碎了的回忆
被撕碎了的回忆 2021-01-03 00:39

I am creating a website for a client, and he wants to be able to have in one page, many upload buttons. When he clicks select files, uploadify uploads the file to the server

4条回答
  •  余生分开走
    2021-01-03 01:09

    I am not sure if the above answers cover uploadify elements that are added dynamically (through AJAX, after the page has been loaded). I faced this problem. Then while reading the "live()" function on the jQuery API, I realised it can be done this way:

    $(document).ready(function(){
        $('.upload_child_photograph').live('uploadifyEvent', function(){
            var child_id = $(this).attr('id').replace('upload_child_photograph_', "");
    
            $('#upload_child_photograph_' + child_id).uploadify({
                'auto'     : false,
                'swf'      : 'uploadify.swf',
                'uploader' : 'uploadify.php', 
                'uploadLimit' : 10, 
                'multi': true,
                'fileSizeLimit' : 0
            });
        });
    
        $(".upload_child_photograph").trigger("uploadifyEvent");
    });
    

提交回复
热议问题