I have and apex:inputFile tag where a user can input a filename to upload on a visualforce page. I have a javascript function which checks and alerts if a filesize is too large. After the Alert the inputfield stays filled with the file. How do I clear the input in javascript.
Visualforce
<apex:inputFile id="inputfile" value="{!newAtt.body}" filename="{!newAtt.name}" onchange="checkFileSize(event)" /> Javascript
<script> function checkFileSize(event) { if(event.target.files[0].size > 2**20*5) { alert('File must be less than 5Mb'); //**Clear input** } } </script>