JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.plupload.com/plupload/js/plupload.full.js"></script>
<div id="unique_id" class="gallery">
<a href="" id="unique_id_uploader">Upload</a>
</div>
<div id="unique_id2" class="gallery">
<a href="" id="unique_id2_uploader">Upload</a>
</div>
JavaScript
var uploaders = new Array();
initUploaders = function(uploaders) {
console.log("initUploaders()");
$(".gallery").each(function() {
var el = $(this);
var button = el.attr("id") + "_uploader";
console.log("Init uploader id:" + el.attr("id"));
var uploader = new plupload.Uploader({
runtimes: 'gears,html5,flash,silverlight,browserplus',
browse_button: button,
max_file_size: '10mb',
url: 'ModuleGallery/Upload/',
flash_swf_url: 'http://www.plupload.com/plupload/js/plupload.flash.swf',
silverlight_xap_url: 'http://www.plupload.com/plupload/js/plupload.silverlight.xap',
filters: [
{
title: "Image files",
extensions: "jpg,gif,png"}
]
});
uploader.bind('FilesAdded', function(up, files) {
uploader.start();
});
uploader.bind('QueueChanged', function (up, files) {
uploader.start();
up.refresh();
});
uploader.init();
uploaders.push(uploader);
});
};
initUploaders(uploaders);