Works with any backend npm install Zero dependencies

getInstance() Lookup

Retrieve an uploader instance by its container ID from anywhere in your code.

// Create with an ID
new MultipleUpload('#my-uploader', { ... });

// Later, from anywhere:
var uploader = MultipleUpload.getInstance('my-uploader');
uploader.upload();

Getting back to an uploader you did not keep

MultipleUpload.getInstance(idOrSelector) returns the live instance bound to a container, or null if there is none. It accepts an id, a selector, or the element itself, which matters when your code is holding a node rather than a string.

What it is for

Anywhere the uploader is created in one place and controlled from another: a toolbar button that starts the queue, a route change that needs to cancel in-flight uploads, a test that needs to inspect state. It saves threading a reference through your application just to reach something the DOM already knows about.

It returns null rather than throwing when nothing is bound, so check before using the result — a container that has not initialised yet looks exactly like one that never will.