javascript - Display the Name of the File in File Upload Button -


here fiddle

this css:

label input[type="file"]  { display: block; margin-top: -20px; opacity: 0; } 

here have text instead of file upload button (as given opacity:0)

how can display file name chosen

note : want display file name near upload text

one way set value of tag current value of file input adding onchange event:

document.getelementbyid('spanfilename').innerhtml = this.value

as can see in full example:

upload file:   <input type="file" onchange=" document.getelementbyid('spanfilename').innerhtml = this.value; imagechangesupplier(this,57);" style="display:block;margin-top: -20px;opacity: 0;" >  <br />  <br />  file selected: <span id='spanfilename'></span>
1 thing need take note of using method produces name of file , adds 'c:/fakepath/' prefix. can replace text give file name.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -