choose file button code example
Example 1: custom input file button
<input id="file-upload" class="p-0" required name="photo" type="file" accept="image/jpeg, image/png, application/pdf" />
::-webkit-file-upload-button {
background: #FF4B2B;
color: white;
padding: 8px 25px;
font-size: 10px;
border-radius: 20px;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
border-color: #FF4B2B;
transition: all 0.15s ease;
letter-spacing: 1px;
box-sizing: border-box;
outline: none;
cursor: pointer;
line-height: 1.5;
display: inline-block;
font-weight: bold;
text-align: center;
white-space: nowrap;
vertical-align: middle;
user-select: none;
border: 1px solid transparent;
}
Example 2: change choose file button text
<button style="display:block;width:120px; height:30px;" onclick="document.getElementById('getFile').click()">Your text here</button>
<input type='file' id="getFile" style="display:none">
Example 3: File Upload Button and display file javascript
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
<label for="file-upload" class="custom-file-upload">
<i class="fa fa-cloud-upload"></i> Upload Image
</label>
<input id="file-upload" name='upload_cont_img' type="file" style="display:none;">
</form>
Example 4: input type file css
<style>
div.fileinputs {
position: relative;
}
div.fakefile {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
}
input.file {
position: relative;
text-align: right;
-moz-opacity:0 ;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
}
</style>
<div class="fileinputs">
<input type="file" class="file" />
<div class="fakefile">
<input />
<img src="search.gif" />
</div>
</div>
Example 5: target button of fileinput css
.upload-btn {
display: block;
text-align: center;
margin: 20px auto 20px;
width: 50%;
height: 30px;
background-color: #fcff7f;
line-height: 30px;
}
.upload-btn:hover {
background-color: #c39d5a;
color: white;
cursor: pointer;
}
Example 6: File Upload Button and display file javascript
.custom-file-upload {
border: 1px solid #ccc;
display: inline-block;
padding: 6px 12px;
cursor: pointer;
}