As a one requirement , I need to open file picker by using js. So I have try following code :
HTML
<button onclick="openFilePicker()">
<span>Upload File</span>
<input type="file" id="uploadFile">
</button>
JS
function openFilePicker(){
document.getElementById('uploadFile).click();
}
Above code is working fine if we physically click on upload button by using mouse and file picker is open.
But
When same function openFilePicker() call after some specific task complete. At that time File picker will not open.
At that time It will show me warning :
File chooser dialog can only be shown with a user activation.
Is there any way to remove this warning ?