我上传我的tp照片有问题。我有我的第一张照片,很顺利的s的上传,但第二和第三个什么都没有。我把一个原始图像在数据库中,然后我回到网站测试在上传它删除了我好我的图片链接,但我没有新的来取代它,没有在服务器上的图像。
这是我的密码:
$image = "";$image_2 = "";
$image_3 = "";
if(isset($_FILES['pointpicture']) AND !empty($_FILES['pointpicture']['name']))
{
$taillemax = 2097152;
$extensionvalides = array('jpg','jpeg','png');
if($_FILES['pointpicture']['size'] <= $taillemax)
{
$extensionupload = strtolower( substr(strrchr($_FILES['pointpicture']['name'],'.'),1));
if(in_array($extensionupload,$extensionvalides))
{
$img = RandomString();
$chemin = $abs_path."images/pointpictures/".$img.".".$extensionupload;
$image = "images/pointpictures/".$img.".".$extensionupload;
$resultat = move_uploaded_file($_FILES["pointpicture"]["tmp_name"], $chemin);
if($resultat)
{
//select current user old profile picture name
$avatar = $mysqli->query("SELECT image FROM pointsofinterest WHERE id = ".$pointid )->fetch_object()->image;
$filename = $abs_path."images/pointpictures/".$avatar;
if (file_exists($filename)) {
unlink($filename);
}
system('chmod 775 "'.$chemin.'"');
}
else { header('Location: '.$base_url.'mespoints?modif=uploaderror'); }
} else { header('Location: '.$base_url.'mespoints?modif=badformat'); }
} else { header('Location: '.$base_url.'mespoints?modif=picistofat'); }
}
else
{
$image = $mysqli->query("SELECT image FROM pointsofinterest WHERE id = '".$pointid."'")->fetch_object()->image;
}
if(isset($_FILES['pointpicture2']) AND !empty($_FILES['pointpicture2']['name']))
{
$taillemax = 2097152;
$extensionvalides = array('jpg','jpeg','png');
if($_FILES['pointpicture2']['size'] <= $taillemax)
{
$extensionupload = strtolower( substr(strrchr($_FILES['pointpicture2']['name'],'.'),1));
if(in_array($extensionupload,$extensionvalides))
{
$img = RandomString();
$chemin = $abs_path."images/pointpictures/".$img.".".$extensionupload;
$image_2 = "images/pointpictures/".$img.".".$extensionupload;
$resultat = move_uploaded_file($_FILES["pointpicture2"]["tmp_name"], $chemin);
if($resultat)
{
//select current user old profile picture name
$avatar = $mysqli->query("SELECT image_2 FROM pointsofinterest WHERE id = ".$pointid )->fetch_object()->image;
$filename = $abs_path."images/pointpictures/".$avatar;
if (file_exists($filename)) {
unlink($filename);
}
system('chmod 775 "'.$chemin.'"');
}
else { header('Location: '.$base_url.'mespoints?modif=uploaderror'); }
} else { header('Location: '.$base_url.'mespoints?modif=badformat'); }
} else { header('Location: '.$base_url.'mespoints?modif=picistofat'); }
}
else
{
$image_2 = $mysqli->query("SELECT image_2 FROM pointsofinterest WHERE id = '".$pointid."'")->fetch_object()->image;
}
if(isset($_FILES['pointpicture3']) AND !empty($_FILES['pointpicture3']['name']))
{
$taillemax = 2097152;
$extensionvalides = array('jpg','jpeg','png');
if($_FILES['pointpicture3']['size'] <= $taillemax)
{
$extensionupload = strtolower( substr(strrchr($_FILES['pointpicture3']['name'],'.'),1));
if(in_array($extensionupload,$extensionvalides))
{
$img = RandomString();
$chemin = $abs_path."images/pointpictures/".$img.".".$extensionupload;
$image_3 = "images/pointpictures/".$img.".".$extensionupload;
$resultat = move_uploaded_file($_FILES["pointpicture3"]["tmp_name"], $chemin);
if($resultat)
{
//select current user old profile picture name
$avatar = $mysqli->query("SELECT image_3 FROM pointsofinterest WHERE id = ".$pointid )->fetch_object()->image;
$filename = $abs_path."images/pointpictures/".$avatar;
if (file_exists($filename)) {
unlink($filename);
}
system('chmod 775 "'.$chemin.'"');
}
else { header('Location: '.$base_url.'mespoints?modif=uploaderror'); }
} else { header('Location: '.$base_url.'mespoints?modif=badformat'); }
} else { header('Location: '.$base_url.'mespoints?modif=picistofat'); }
}
else
{
$image_3 = $mysqli->query("SELECT image_3 FROM pointsofinterest WHERE id = '".$pointid."'")->fetch_object()->image;
}
$requete = "UPDATE pointsofinterest SET categorie = '".$pointcat."', titre = '".$pointname."', address = '".$pointaddress."', tel = '".$pointphone."',
longitude = '".$pointlong."', latitude = '".$pointlat."', keywords = '".$pointkeywords."', email = '".$pointemail."', website = '".$pointwebsite."',
description = '".$pointdesc."', facility = '".$pointfacility."', facebook = '".$pointfacebook."', instagram = '".$pointinstagram."', twitter = '".$pointtwitter."',
horairesLundi = '".$pointhoraireslundi."', horairesMardi = '".$pointhorairesmardi."', horairesMercredi = '".$pointhorairesmercredi."',
horairesJeudi = '".$pointhorairesjeudi."', horairesVendredi = '".$pointhorairesvendredi."', horairesSamedi = '".$pointhorairessamedi."',
horairesDimanche = '".$pointhorairesdimanche."', image = '".$image."', image_2 = '".$image_2."', image_3 = '".$image_3."' WHERE id = '".$pointid."'";
mysqli_query($mysqli, $requete);
1条答案
按热度按时间of1yzvn41#
添加
[]
作为你所在领域的名字