We are using this solution to style our "browse" buttons. However, when we use this technique, our "clear" button no longer works in IE. In other words, it doesn't remove the fakepath. Still works in Firefox and Chrome though.
<div id="upload_div">
<li class="uploadlink">
<div class="fakeupload">
<input type="text" name="fakeupload" />
</div>
<input type="file" name="upload" id="uploadFile" class="realupload" onchange="this开发者_如何学运维.form.fakeupload.value = this.value;"/>
<input name="clearinput" type="button" value="Clear" onClick="clearFileInput('upload_div')">
</li>
</div>
Clear button function:
function clearFileInput(tagId) {
document.getElementById(tagId).innerHTML = document.getElementById(tagId).innerHTML;
}
精彩评论