URL.createObjectURL(file[0]);
<input type="file"
id="profilePic" class="rounded-circle pt-5"
style="background-image: url('assets/img/messages-1.jpg');
width:100px; height: 100px; background-size: cover;">
const profilePic = document.getElementById('profilePic');
profilePic
.addEventListener('change', function(){
const url = URL.createObjectURL(profilePic.files[0]);
profilePic.style.backgroundImage = `url(${url})`;
});