1

I have an input file on my jsx, and I want to change the text "Choisir un fichier" and "Aucun fichier choisi"

My code is :

<div className="form-group">
    <label className="control-label col-sm-2" ><strong>Site - Logo (150 x 30px)</strong></label>
    <div className="col-sm-10">
        <input type="file" className="form-control-file" onChange={this.handleImgLogoChange} style={{border:'.1rem solid #d9d9d9', borderRadius:'.2rem'}}/>
    </div>
</div>

When I run it, I get:

enter image description here

How to change the default text of input file ?

2
  • If I understand the question correctly, we are talking about input styling. If this is an input, then the placeholder is responsible for it. Look here, see if it helps. (w3schools.com/howto/howto_css_placeholder.asp) Commented Jun 3, 2020 at 14:12
  • @al-bulat I talk about the text of the button of the standard input file Commented Jun 3, 2020 at 14:29

1 Answer 1

2
        <div style={{width: 80, height: 80, border: '1px solid red', position: 'relative'}}>
          <label for='file' style={{position: 'absolute', width: 80, height: 80, cursor: 'pointer'}}>select file</label>
          <input id='file' type='file' onChange={this.handleFileUpload} style={{opacity: 0}} />
        </div> 

maybe like this?

u can check online demo on stackblitz demo

Sign up to request clarification or add additional context in comments.

2 Comments

I talk about the text of the button of the standard input file
first, the input type of file is not change the default text, u must use another way to emulator the text of button of the standard input file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.