i have html input type file control. when select file big name, shows complete filename in firefox causes bad ui. there solution problem changing name etc?
you can handle way:
- make html
input file
control hidden , addonchange
event handler change selected file name - add readonly html
textbox
control showing changed file name - add html
button
controlonclick
event handler trigger file control's click event
html:
<input type="text" id="txtfile" readonly="true" /> <input type="button" id="btn" value="browse..." onclick="browsefile();" /> <input type="file" id="file1" name="file1" onchange="setfilename(this.value);" />
css:
#file1 { display: none; }
js:
function browsefile() { document.getelementbyid('file1').click(); } function setfilename(filename) { /* manipulate file name here */ filename = filename.substr(0, filename.lastindexof('.')); document.getelementbyid('txtfile').value = filename; }
Comments
Post a Comment