You have error in this line...
document.getElementById('txtH').value = document.getElementById('file1').value;
You are accessing the File Uploader's path by
getElementById('file1')
, but the id is not 'file1', it is 'file' as per below...
<input type="file" name="file1" id="file"></input>
Change the function to the below code, it will work.
function fun()
{
document.getElementById('txtH').value=document.getElementById('file').value;
alert("hai");
}