How to get file name without extension in file upload using java script
asp.net, file-upload, javascript
Solution
Try this:
$('#test').change(function() {
//something like C:\fakepath\1.html
var fpath = this.value;
fpath = fpath.replace(/\\/g, '/');
var fname = fpath.substring(fpath.lastIndexOf('/')+1, fpath.lastIndexOf('.'));
console.log(fname);
});
http://jsfiddle.net/rooseve/Sdq24/
Problem
i am going to upload file using file upload control in asp.net . now i want to get file name without extension using java script . i want to validate file name should be only integer format ``` $(function () { $('#<%=File1.ClientID %>').change(function () { var uploadcontrol = document.getElementById('<%=File1.ClientID%>').value; }) }) ```