Can you change the text inside FileUpload?
I wanted to change the text "No file selected"
There is no way to change this message in the text within input
, each browser renders the element in its own way, but there is a way to use some workaround to solve. An alternative is to add a label that overlays the original, allowing you to use any text you want:
function fileChange() {
var e = document.getElementById('file');
if(e.value == "")
{
fileLabel.innerHTML = "Nenhum arquivo selecionado";
}
else
{
var theSplit = e.value.split('\');
fileLabel.innerHTML = theSplit[theSplit.length-1];
}
}
fileChange();
input[type=file]{
color:transparent;
}
#fileLabel {
margin-left: -160px
}
<div>
<input type='file' title="Selecione um arquivo" id="file" onchange="fileChange()" >
<label id="fileLabel">Nenhum arquivo selecionado</label>
</div>