How to trigger a click() event on LWC element
+1 to @sfdcfox, A sample example to open a file selector prompt on clicking of a button is here in this playground:- Playground
<template>
<input id="fileInput" type="file" style="display:none;" />
<input type="button" value="Choose Files!" onclick={handleclick}/>
</template>
JavaScript
handleclick(){
this.template.querySelector('input').click();
}
It appears that there's no way in LWC to send events to a component's internal components, which is why this code isn't working. Instead, use a normal HTML input and use that instead.