<input name="imgfile" type="file" id="imgfile" size="40" onchange="getFileName('t',this.form.imgfile);" />
<input type="text" id="t">
<script type="text\javascript">
function getFileName(controlID,fileBox) {
if (fileBox.value){
var path = fileBox.value;
var fileName = path.substring(path.lastIndexOf('\\')+1,path.lastIndexOf('.'));
document.getElementById(controlID).value = fileName;
}
}
</script>
<input type="text" id="t">
<script type="text\javascript">
function getFileName(controlID,fileBox) {
if (fileBox.value){
var path = fileBox.value;
var fileName = path.substring(path.lastIndexOf('\\')+1,path.lastIndexOf('.'));
document.getElementById(controlID).value = fileName;
}
}
</script>