Actually this can be done in pure css and it is quite easy ...
HTML code
<label class="filebutton"> Browse For File! <span><input type="file" id="myfile" name="myfile"></span> </label>
CSS styles
label.filebutton { width:120px; height:40px; overflow:hidden; position:relative; background-color:#ccc; } label span input { z-index: 999; line-height: 0; font-size: 50px; position: absolute; top: -2px; left: -700px; opacity: 0; filter: alpha(opacity = 0); -ms-filter: "alpha(opacity=0)"; cursor: pointer; _cursor: hand; margin: 0; padding:0; }
The idea is to position the input absolutely inside your label. set the input font size to something big, which will increase the size of the browse button. He then takes some trial and error using the negative left / top properties to place the enter button behind your label.
When positioning the button, set the alpha value to 1. When you are done, set it to 0 (so you can see what you are doing!)
Make sure you check the browsers because they all display the enter button in a slightly different size.
Here you can see an example (Add Track): http://rakmastering.com/upload/
user210437 Sep 01 '10 at 16:21 2010-09-01 16:21
source share