Topic: PRe-Populating File Select

Hi,
I've been looking for help on this but can't find a working solution. Only other questions.

I have a page where someone can create a new post and upload images to be shown with the post using Plupload UI.

I am trying to build an editing interface so a user can modify the article, including the images uploaded by:
Deleting existing images
re-ordering (i can do this using the sortable option)
Uploading new files

How can I pre-populate the plupload window with existing images that have already been added?

Here is what I have at the moment but it does nothing but break the interface:

$("#stock_posts_uploader").plupload({
            // General settings
            runtimes: 'html5,flash,silverlight,html4',
            url: "_upload.php",

            // Maximum file size
            max_file_size: '16mb',

            // buttons
            buttons: {browse: true, start: false, stop: false},

            // Specify what files to browse for
            filters: [
                {title : "Image files", extensions : "jpg,gif,png"}
            ],

            // Sort files
            sortable: true,

            // Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
            dragdrop: true,

            // Views to activate
            views: {
                list: false,
                thumbs: true, // Show thumbs
                active: 'thumbs'
            },

            // maximum files to allow upload
            max_file_count: 5,

            unique_name: true,

            init: prefill,

            // Flash settings
            flash_swf_url: '/plupload/js/Moxie.swf',

            // Silverlight settings
            silverlight_xap_url: '/plupload/js/Moxie.xap'
        });

        function prefill(up) {
            console.log(plupload.VERSION);
            var files = new Array();
            var f = new plupload.File({
                id: "acompletelyrandomstring",
                name: "uploads/Malfunctioning_Eddie.jpg",
                size: "19000",
                loaded: "19000",
                percent: "100",
                status: plupload.DONE,
                type: "image/jpeg"
            });
            files.push(f);


            up.uploader_count = 1;

            var queueprogress = new plupload.QueueProgress();
            queueprogress.size = 1;
            queueprogress.loaded = 19000;
            queueprogress.uploaded = 1;
            queueprogress.percent = 100;
            queueprogress.failed = 0;
            queueprogress.queued = 0;

            up.total = queueprogress;
            up.total.size = 19000;
            up.total.percent = 100;
            
            up.trigger("FilesAdded", files);
            up.trigger("QueueChanged");
            up.refresh();
        }
    });

I see that plupload.Uploader has an option for addFiles. IS there an alternative for UI? or a workaround?

Re: PRe-Populating File Select

You can re-populate, but it's not straightforward. Are you looking to re-upload all the images for every change?

in general UI and Queue widgets are there to meet generic cases. Every time you need something specific, I'd recommend to use Core API instead and come up with your own visual implementation.

If you want to see your issue fixed, do not report it here, do it on - GitHub.