Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
As we know that is File Upload control we have a browse button which has text as "Browse", which is by default.

But, while working in a multi-lingual project, we need to change the translation of every thing that appears in a page.

But I can't find a way by which I can code to translate the text of this File Upload browse button.

Can anybody suggest how to do this ?

Thanks in advance.

i guess there is no way even using HTML it will be automatically named in English as Brows...

also i guess it will be changed as the OS or the users or the browser level
i mean>> Whatever language/localization the user's browser is in (usually based on the OS setting), that's the language they'll get on the "Browse..." button.

any way i found this trick somewhere on the internet

Although there is direct way to change the Caption of InputFile control,but you can always go for alternative way,

1>Add InputFile control to you page let's say "fileUpload" and make it Hidden or invisible.

2>Add new HTMLButton on form with TextWhatever you wanted to give it to your fileupload button (in addition you can also add TextBox too to show uploaded file name when events being gets handle at server side).

3>Oncick even of above button use below javascript

document.getElementById("fileUpload").click();

It will do the same thing without showing up default InputFile control.
 
Share this answer
 
C#
<input type="file" id="txtFile" style="display:none;"  runat="server" />
<input type="text" id="txtFakeText" readonly="readonly" />
<input type="button" value="Navegar" style="position:fixed"  önclick="HandleFileButtonClick();" />



function HandleFileButtonClick() {
debugger;
var file = document.getElementById('txtFile');
file.click();
var doc = file.value;
document.getElementById("txtFakeText").value = doc;
document.getElementById('txtFile').value = doc;
}
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900