I want to make a function that empties a files content if a button is clicked when the value is not etmpy, is this at all possible?
function file_empty() {
var file = document.getElementById('file');
if(file.value !=="") {
// empty the file
return true;
}
}
<input name="uploaded" type="file" id="file" />
<input type="submit" value="empty-if-full" onclick="return file_empty();" />