Show filename if selected

This commit is contained in:
alvierahman90 2017-10-24 22:57:03 +01:00
parent a1c555847d
commit c47b246b80
2 changed files with 14 additions and 1 deletions

View File

@ -81,3 +81,9 @@ div {
width: 98%;
margin: 1%
}
#uploadFile {
text-align: center;
font-family: rawengulk-sans;
font-size: 1.5em;
}

View File

@ -9,10 +9,17 @@
enctype = "multipart/form-data">
<div class="fileUpload btn">
<span>Upload</span>
<input class="upload btn" type = "file" name = "file" />
<input id="uploadBtn" class="upload btn" type="file" name="file" />
</div>
<p id="uploadFile"></p>
<input class="btn" type = "submit"/>
</form>
<script>
document.getElementById("uploadBtn").onchange = function () {
filename = document.getElementById('uploadBtn').value.split('C:\\fakepath\\')[1];
document.getElementById("uploadFile").innerHTML= filename;
};
</script>
</body>
</html>