How set the culture for fileupload (input file) control in ASP.NET

3.7k views Asked by At

I encounter problem when changing culture (language) on my website. In fact all the controls correctly change language. But only controls "asp: FileUpload" do not change. The text description is always the same ... Is it possible to force the language on the buttons like "" or "?

Thank you already in advance.

2

There are 2 answers

0
Arno 2501 On BEST ANSWER

You can hide the button thru CSS styling selecting its ID.

<style type="text/css">
    input.fileUpload{
        display: block;
        visibility: hidden;
        width: 0;
        height: 0;
    }
</style>

Then create a button that would trigger the file upload.

<script type="text/javascript">
$("#alternateUploadButton").click(function(){
    $("#fileUpload").click();
});
</script>
<input type="file" id="fileUpload" name="fileUpload">
<button id="alternateUploadButton">
    Get a file or whatever name you want
</button>

http://jsfiddle.net/SPVkq/

0
Clafou On

Unfortunately the "Browse..." label on the file upload button is provided by the browser, not by your markup, and so it out of your control. There are some hacks, but you may want to consider if it's worth the trouble, as this "Browse..." button should be in a language that the user understands since it matches their browser's language.

See this other post for more info: ASP.NET FileUpload - How to change the language of the "Browse..." button description?