Can you please check the below code? Hope it will work for you.
We set position: relative; in .custom-drop-file
gave position: absolute; and height & width both 100%, and opacity: 0;. to input
.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<style>
.custom-drop-file{
position: relative;
padding: 24px 16px;
border: 1px solid #e4e4e4;
cursor: pointer;
}
.custom-drop-file input {
position: absolute;
height: 100%;
width: 100%;
opacity: 0;
z-index: 1;
cursor: pointer;
}
.custom-drop-file img {
margin-bottom: 8px;
width: 40px;
}
.custom-drop-file p {
margin: 0;
color: #a4a4a4;
}
</style>
</head>
<body>
<div class="file-upload-content">
<label>Profile Picture</label>
<div class="form-group custom-drop-file text-center">
<input type="file" class="form-control" id="img-upload" placeholder="Upload a picture">
<img src="https://www.flaticon.com/svg/static/icons/svg/126/126477.svg" alt="icon">
<p>Upload Picture</p>
</div>
</div>
</body>
</html>