Since there is no File Upload form functionality in MDL, we need to create some css, html and js. I have tried to make it as simple as possible.
CSS
Source code viewer
.mdl-button--file input { cursor: pointer; height: 100%; right: 0; opacity: 0; position: absolute; top: 0; width: 300px; z-index: 4; } .mdl-textfield--file .mdl-textfield__input { box-sizing: border-box; width: calc(100% - 32px); } .mdl-textfield--file .mdl-button--file { right: 0; }Programming Language: CSS
HTML
Source code viewer
<div class="mdl-textfield mdl-js-textfield mdl-textfield--file"> <input class="mdl-textfield__input" placeholder="No file chosen" type="text" id="TEXT_ID" readonly /> <div class="mdl-button mdl-button--icon mdl-button--file"> <input type="file" name="NAME" id="ID" onchange="document.getElementById('TEXT_ID').value=this.files[0].name;" /> </div> </div>Programming Language: HTML