上传默认图像未被替换 [英] Upload default image not being replaced

查看:82
本文介绍了上传默认图像未被替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i有上传功能,如果个人资料图片没有上传,我想设置默认图片



以下代码显示默认图片,但当我上传图片时,默认图片停留在那里并没有取代它吗?



我尝试过:



Hi,
i have an upload feature and i wanted to set a default image if profile picture not uploaded

below code shows default image but when i upload the picture the default image stays there and doesnt replace it?

What I have tried:

$stmt = $conn->query("SELECT ProfilePicture FROM Profile WHERE UserID='$id'");
while($image =$stmt->fetch(PDO::FETCH_ASSOC)) {
if (!$_REQUEST['file']) {
echo "<img src=imgs/default.jpg width='150' height='150'/>";	
} else {
echo "<img src=uploads/".$image['Picture']."' width='150' height='150'/>"; 
}

推荐答案

stmt =


conn-> query(SELECT ProfilePicture FROM Profile WHERE UserID ='
conn->query("SELECT ProfilePicture FROM Profile WHERE UserID='


id');
while(
id'"); while(


这篇关于上传默认图像未被替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆