Html how to change the choose file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Html how to change the choose file

how can I change (choose file) when I use (input type="file"

6th Oct 2018, 6:19 AM
Ahmed Abd ALMotalb
Ahmed Abd ALMotalb - avatar
9 Answers
+ 2
to make really simple, even if it's a bit dirty using a one file solution : <input type="file" id="getFile" style="display: hidden"> <button onclick="document.getElementById('getFile').click()"> Your Label Here </button>
7th Oct 2018, 6:38 AM
Xavier Heugue
Xavier Heugue - avatar
+ 6
I think you can't do with standard input. unless some custom buttons and js. may be with bootstrap. https://mdbootstrap.com/components/bootstrap-file-input/
6th Oct 2018, 5:10 PM
Roneel
Roneel - avatar
+ 6
https://code.sololearn.com/Wfqu1gF9yngC/?ref=app
7th Oct 2018, 3:20 PM
Roneel
Roneel - avatar
+ 4
🌴Vincent Berger🌴 this is not the question.
6th Oct 2018, 5:26 PM
Roneel
Roneel - avatar
+ 3
<input type="file" accept="text/pdf" /> <input type="file" accept="application/exe" /> Additional you can add required to the end of the input tag, that makes the input mandotary before submitting
6th Oct 2018, 5:20 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
0
A simple hack exists by hiding your button with css, then, create another one, which contains the label you want. Next, affect to the onclick event of the button, the function click of your hidden element
6th Oct 2018, 11:38 PM
Xavier Heugue
Xavier Heugue - avatar
0
how can I do it with css can you give me example for it
7th Oct 2018, 6:33 AM
Ahmed Abd ALMotalb
Ahmed Abd ALMotalb - avatar
0
thank for question
7th Oct 2018, 11:10 AM
AHMED HASSAN MOHAMED
AHMED HASSAN MOHAMED - avatar
0
It's changed with me thanks "roneel" and "xavier"
7th Oct 2018, 3:32 PM
Ahmed Abd ALMotalb
Ahmed Abd ALMotalb - avatar