Topic: flash problem, only uploads one file

When i use the Flash uploader, then it only uploads one file of the entire list. I don't seem to have this problem with the HTML5 uploader.

Anyone any idea what the problem could be...? Perhaps a bug?

I'm using the 1.5.4 version.

Re: flash problem, only uploads one file

I use flash runtime with the last version and don't have this problem. post your entire code, preferably in jsfiddle, like:

http://jsfiddle.net/LeandroJF/AM8Zp/

Re: flash problem, only uploads one file

Sorry, i can't put it in a jsfiddle. I don't have a remote host running, where i can put all my js/swf files. But here's the JS code i'm using. Hopefully it's enough.

<script type="text/javascript">
$(function() {
    var uploader = new plupload.Uploader({
        runtimes : 'flash',
        browse_button : 'pickfiles',
        container : 'upload-container',
        max_file_size : '10mb',
        url : '<?= $this->_baseUrl; ?>/cms/media/upload',
        flash_swf_url : '<?= $this->_baseUrl; ?>/js/plupload/plupload.flash.swf',
        filters : [
            //{title : "Image files", extensions : "jpg,gif,png"}//,
            //{title : "Zip files", extensions : "zip"}
        ],
        //resize : {width : 320, height : 240, quality : 90}
    });

    uploader.bind('Init', function(up, params) {
        $('#filelist').html("");
    });

    $('#uploadfiles').click(function(e) {
        uploader.start();
        e.preventDefault();
    });

    uploader.init();

    uploader.bind('FilesAdded', function(up, files) {
        $.each(files, function(i, file) {
            $('#filelist').append(
            '<div id="' + file.id + '">' +
                '<div class="fl">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b> </div>' +
                '<div class="fr removeFile" data-fileid="' + file.id + '">X</div>' +
                '<div class="fc"></div>' +
            '</div>');
        });

        up.refresh(); // Reposition Flash/Silverlight
    });
    
    $('.removeFile').live('click', function(e) {
        $this = $(this);
        uploader.removeFile ( uploader.getFile ( $this.data('fileid') ) );
        uploader.refresh ( );
        
        $this.parent().remove();
    });

    uploader.bind('UploadProgress', function(up, file) {
        $('#' + file.id + " b").html(file.percent + "%");
    });

    uploader.bind('Error', function(up, err) {
        $('#filelist').append("<div>Error: " + err.code +
            ", Message: " + err.message +
            (err.file ? ", File: " + err.file.name : "") +
            "</div>"
        );

        up.refresh(); // Reposition Flash/Silverlight
    });

    uploader.bind('FileUploaded', function(up, file) {
        $('#' + file.id + " b").html("100%");
    });
});
</script>

The $this->_baseUrl simply resolves to: http://127.0.0.1.

If this doesn't give you any ideas, then please let me know and i'll try to put everything online. So you can have a look at it in a real environment.

Re: flash problem, only uploads one file

try changing to html5 runtime and see if you get the same problem.

5 (edited by vivendi 2012-10-25 20:20:32)

Re: flash problem, only uploads one file

LeandroJF wrote:

try changing to html5 runtime and see if you get the same problem.

No the HTML5 runtime worked fine for me. But i figured out what the problem was.

I removed this line from the php upload script.

die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');

I didn't realize that the flash runtime actually used the json data. So i've placed all the json calls back and everything works great again! smile