<input type="file" value="Browse" name="avatar" id="id_avatar" />
I tried to modify the value
, but it's not working. How to customize the button text?
<input type="file" value="Browse" name="avatar" id="id_avatar" />
I tried to modify the value
, but it's not working. How to customize the button text?
The "upload file..." text is pre-defined by the browser and can't be changed. The only way to get around this is to use a Flash- or Java-based upload component like swfupload.
EDIT: I see now by the comments that you are asking about the button text, and not the file path. My bad. I'll leave my original answer below in case someone else who stumbles upon this question interprets it the way I originally did.
2nd EDIT: I had deleted this answer because I decided that I misunderstood the question and my answer was not relevant. However, comments in another answer indicated that people still wanted to see this answer so I'm undeleting it.
MY ORIGINAL ANSWER (I thought the OP was asking about the path, not the button text):
This is not a supported feature for security reasons. The Opera web browser used to support this but it was removed. Think about what would be possible if this were supported; You could make a page with a file upload input, pre-populate it with a path to some sensitive file and then auto-submit the form using javascript triggered by the onload event. This would happen too fast for the user to do anything about it.
You can change it with a good shot of CSS/JS. This is discussed here and there fairly a lot. The one at quirksmode.org is a good article.