Im trying to have a single upload file button without the choose file or submit buttons. I posted the image of my upload file button and the HTML and was wondering if anyone could point me in the right direction. Thanks
<a href="#" class="btn btn-info btn-sm remove">
<span class="glyphicon glyphicon-upload"></span> Upload File
</a>
Use a label tag and point its for attribute to the id of the default HTML file upload button. By doing this, clicking the label element in the browser toggles the default HTML file upload button (as though we clicked it directly).
The <input type="file"> defines a file-select field and a "Browse" button for file uploads. To define a file-select field that allows multiple files to be selected, add the multiple attribute. Tip: Always add the <label> tag for best accessibility practices!
why don't you hide your <input type="file" id="file">
and show only your image button, when someone click your button use this code:
HTML:
<input type="file" id="file" style="display:none;" />
<button id="button" name="button" value="Upload" onclick="thisFileUpload();">Upload</button>
SCRIPT:
<script>
function thisFileUpload() {
document.getElementById("file").click();
};
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With