.profile-pic {
position: absolute;
border-radius: 50%;
height: 150px;
width: 150px;
left: 20%;
top: 42%;
background-size: cover;
background-position: center;
background-blend-mode: multiply;
vertical-align: middle;
text-align: center;
color: transparent;
transition: all .3s ease;
text-decoration: none;
cursor: pointer;
}
.profile-pic:hover {
background-color: rgba(0,0,0,.5);
z-index: 10000;
color: #fff;
transition: all .3s ease;
text-decoration: none;
}
.profile-pic span {
display: inline-block;
padding-top: 4.5em;
padding-bottom: 4.5em;
}
<form action="upload.php" method="POST" enctype="multipart/form-data">
<div class="profile-pic" style="background-image: url('https://soygrowers.com/wp-content/uploads/2017/02/default_bio_600x600.jpg')">
<span class="glyphicon glyphicon-camera"></span>
<span>Change Image</span>
</div>
</form>
我正在为用户制作一个个人资料页面,当我点击它时我创建了我的个人资料图片它没有打开图像文件夹。有帮助吗?我只是想知道我做错了什么。我以前从未做过这样的事情。
答案 0 :(得分:1)
您必须包含文件输入才能选择文件。
<div class="profile-pic" onclick="document.getElementById('selectedFile').click();">
<input type="file" id="selectedFile" style="display: none;" />
<span class="glyphicon glyphicon-camera"></span>
<span>Change Image</span>
</div>