1. js版
<input style="visibility:hidden" id="upload" type="file" name="xxx" onchange="var a=this.value;alert(a);document.getElementById('uploadname').innerHTML=a;" />
<a id="uploadname" href="javascript:document.getElementById('upload').click();">上传</a>
2. jquery 版本
<!--jquery 版-->
<input type="file" id="jqupload" />
<a id="uploadimg" >jquery上传</a>
<script type="text/javascript" src="Scripts/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$(function () {
$("#jqupload").change(function () {
var v = $(this).val();
alert(v);
})
$("#uploadimg").click(function () {
$("#jqupload").click();
})
})
</script>