<div class="card">
  <h1>Progress bar</h1>
  <label for="file">
    <input id="file" type="file" />
    Choose file
  </label>
  <progress id="fileProgress" max="100" value="0"> 70% </progress>
</div>

<p id="success">Success!</p>
* {
  font-family: arial;
}
body {
  min-height:100vh;
   padding: 20px;
   display: flex;
   align-items: center;
   justify-content: center;
  flex-direction:column;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 300px;
  margin: 0 0 20px 0;
  box-shadow: 0 0 20px 10px rgba(0,0,0,0.12);
  padding: 20px;
}

h1 {
  margin: 0 0 20px 0;
}


input {
  font-size: 16px;
  padding: 4px;
}

progress {
  display: none;
  border: 0;
  height: 12px;
  border-radius: 10px;
}
progress::-moz-progress-bar,
progress::-webkit-progress-bar {
  background-color: #e3a81d;
}
progress::-webkit-progress-value {
  background-color: #e3a81d;
}


p {
  display: none;
}

input[type="file"] {
    display: none;
}
label {
  border: 1px solid #ccc;
  display: inline-block;
  padding: 10px 20px;
  cursor: pointer;
  width: 100px;
  text-align:center;
  margin: 0 0 20px 0;
}
const file = document.getElementById("file");
const progress = document.getElementById("fileProgress");
const success = document.getElementById('success');

file.addEventListener("change", function(event) {
  const i = event.target;
  i.style.opacity = 0.5;
  i.disabled = true;
  progress.style.display = "block";
  setInterval(fakeProgress, 200);
})

const fakeProgress = () => {
  if (progress.value >= 100) {
    clearInterval(fakeProgress)
    success.style.display = "block";
    return;
  };
  progress.value += 10
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.