Solution 1 :

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>

Problem :

I have tried to change a placeholder. But it doesn’t work. It by default shows no file chosen placeholder. And I want to design placeholder with image and text within input field as given below. I have designed form using bootstrap.enter image description here

My output

html code:

<form>
 <p>Profile Picture</p>     
   <div class="form-group">
     <input type="file" class="form-control" id="img-upload" 
      placeholder="Upload a picture">
   </div>
</form>

CSS code:

      input[type="file"] {
        background: url("../img/images/upload-file.png") no-repeat;
        background-position: center;
        height: 110px;
       }

Comments

Comment posted by Mhd Alaa Alhaj

you have to add your code so we can help you

By