External Trigger
Trigger file selection from any button outside the uploader component.
What you should see: the uploader has no visible button of its own; the separate button on the page opens the file picker through the JS API. Useful when the trigger must live in a toolbar.
Drag & drop files here, or paste from clipboard
<core-upload id="externalTriggerUploader"
asp-upload-url="/api/upload/upload"
asp-multiple="true"
asp-progress="true"
asp-auto-upload="true">
</core-upload>
<button id="btn-external-browse">Browse Files (External)</button>
<script>
var uploader = CoreUpload.getInstance('#externalTriggerUploader');
document.getElementById('btn-external-browse')
.addEventListener('click', function() {
uploader.browse();
});
</script> Starting the upload from elsewhere
With asp-auto-upload="false" the queue waits, and anything on the page can start it — a form's submit handler, a wizard's next button, a toolbar rendered by a different component entirely.
Reaching the instance
CoreUpload.getInstance(idOrSelector) returns the uploader bound to a container, so the external trigger does not need a reference passed to it. That is what keeps the two halves of the page decoupled instead of threading an object between them.