I want to display the number of lines a selected csv file is having before i upload it to express server. I am using multer for the uploading the file to server.
<input type="file" name="data_file" id="name" required>
<button type="button" onclick="confirm()"> Submit </button>
The follwing is the action to be taken once the button is clicked on
function confirm() {
let fullPath = document.getElementById('name').value;
let fileName = fullPath.replace(/^.*[\\\/]/, '');
console.log(fileName.substring(fileName.lastIndexOf('/') + 1));
document.getElementById("details").innerHTML = `
<b> Data file: </b> ${fileName} <br>
<br> <input type="submit" id="submit" value="Confirm Sendout"/>`;
document.getElementsByClassName("confirm")[0].style.display = "block";
}