I know that it’s possible to replace the browse button, which is generated in html, when you use input tag with type='file.
I’m not sure what is the best way, so if someone has experience with this please contribute.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The best way is to make the file input control almost invisible (by giving it a very low opacity – do not do ‘visibility: hidden‘ or ‘display: none‘) and absolutely position something under it – with a lower z-index.
This way, the actual control will not be visible, and whatever you put under it will show through. But since the control is positioned above that button, it will still capture the click events (this is why you want to use opacity, not visibility or display – browsers make the element unclickable if you use those to hide it).
This article goes in-depth on the technique.