I'm using this to allow the user to select and upload a file:
<input id="fileInput" type="file" ng-file-select="onFileSelect($files)">
This correctly show:
When user clicks 'Upload', I upload the file.
When the user clicks 'Remove', how do I clear out the file name?
Simply clear the value of the file input element:
document.getElementById('remove').addEventListener('click', function () {
document.getElementById('fileInput').value = ''
});
Here's a demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With