J'ai un problème avec la fonction getimagesize qui m'affiche cette erreur quand je upload une image voici mon code :
<?php
require_once('include/mysql.php');
if (isset($_SESSION['login']))
{
$login = htmlentities($_SESSION['login']);
$verification_droit_admin = $bdd->prepare("SELECT `droit` FROM membres WHERE login = :login ");
if($verification_droit_admin->execute(array(':login' => $login)) && $row = $verification_droit_admin->fetch())
{
$droit = $row['droit'];
}
if($droit == '2')
{
?>
<legend><h2><font color="black">Ajouter Top Match</font></h2></legend>
<center>
<?php
if (isset($_POST['submit_top_match']))
{
if(isset($_POST['name_adversaire'], $_POST['name_games'], $_POST['jours_top_match'], $_POST['mois_top_match'], $_POST['annees_top_match'], $_POST['heures_du_match'], $_POST['minutes_du_match'], $_POST['ladder_du_match'], $_FILES['logo_adversaire']))
{
$name_adversaire = trim(addslashes($_POST['name_adversaire']));
$name_games = trim(addslashes($_POST['name_games']));
$jours_top_match = trim(addslashes($_POST['jours_top_match']));
$mois_top_match = trim(addslashes($_POST['mois_top_match']));
$annees_top_match = trim(addslashes($_POST['annees_top_match']));
$heures_du_match = trim(addslashes($_POST['heures_du_match']));
$minutes_du_match = trim(addslashes($_POST['minutes_du_match']));
$ladder_du_match = trim(addslashes($_POST['ladder_du_match']));
$taille_maxi_image = '300000';
$dossier_image = 'img/base/';
$extensions_image = array('.png');
$taille_image = filesize($_FILES['logo_adversaire']['tmp_name']);
$extension_image = strrchr($_FILES['logo_adversaire']['name'], '.');
$logo_adversaire = basename($_FILES['logo_adversaire']['name']);
if(empty($name_adversaire))
{
echo '<h3><font color="#ff0000"><b>Le champs du nom de l\'équipe adversaire est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($name_games))
{
echo '<h3><font color="#ff0000"><b>Le champ pour le nom du jeux est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($jours_top_match))
{
echo '<h3><font color="#ff0000"><b>Le jour du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($mois_top_match))
{
echo '<h3><font color="#ff0000"><b>le champ moi du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($annees_top_match))
{
echo '<h3><font color="#ff0000"><b>le champ année du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($heures_du_match))
{
echo '<h3><font color="#ff0000"><b>le champ heure du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($minutes_du_match))
{
echo '<h3><font color="#ff0000"><b>le champ minute du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($ladder_du_match))
{
echo '<h3><font color="#ff0000"><b>le champ ladder du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else if(empty($ladder_du_match))
{
echo '<h3><font color="#ff0000"><b>le logo du top match est vide</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else
{
list($width, $height, $type, $attr) = getimagesize($logo_adversaire);
if ($width == '100' && $height == '100')
{
$logo_adversaire = preg_replace('/([^.a-z0-9]+)/i', '-', $logo_adversaire);
$logo_adversaire = str_replace($logo_adversaire,'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ','AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
// je vérifie que l'images n'existe déjà pas.
if (file_exists($dossier_image. $logo_adversaire))
{
echo '<h3><font color="#ff0000"><b>le fichier '.htmlentities($logo_adversaire).' existe déjà</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else
{
if(!in_array($extension_image, $extensions_image))
{
echo '<h3><font color="#ff0000"><b>Merci de upload une image en format png</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else
{
if($taille_image > $taille_maxi_image)
{
echo 'l\'image à une taille trop grosse';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
if(move_uploaded_file($_FILES['logo_adversaire']['tmp_name'], $dossier_image . $logo_adversaire))
{
echo 'Le logo de la team adversaire à bien été upload';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else
{
echo '<h3><font color="#ff0000"><b>Echec : Le logo à pas été upload</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
$insertion_top_match = $bdd->prepare('INSERT INTO `top_match` (`name_adversaire`, `name_games`, `jours_top_match`, `mois_top_match`, `annees_top_match`, `heures_du_match`, `minutes_du_match`, `ladder_du_match`, `logo_adversaire`)
VALUES(:name_adversaire, :name_games, :jours_top_match, :mois_top_match, :annees_top_match, :heures_du_match, :minutes_du_match, :ladder_du_match, :logo_adversaire)');
$insertion_top_match->bindValue(':name_adversaire', $name_adversaire, PDO::PARAM_STR);
$insertion_top_match->bindValue(':name_games', $name_games, PDO::PARAM_STR);
$insertion_top_match->bindValue(':jours_top_match', $jours_top_match, PDO::PARAM_STR);
$insertion_top_match->bindValue(':mois_top_match', $mois_top_match, PDO::PARAM_STR);
$insertion_top_match->bindValue(':annees_top_match', $annees_top_match, PDO::PARAM_STR);
$insertion_top_match->bindValue(':heures_du_match', $heures_du_match, PDO::PARAM_STR);
$insertion_top_match->bindValue(':minutes_du_match', $minutes_du_match, PDO::PARAM_STR);
$insertion_top_match->bindValue(':ladder_du_match', $ladder_du_match, PDO::PARAM_STR);
$insertion_top_match->bindValue(':logo_adversaire', $logo_adversaire, PDO::PARAM_STR);
$insertion_top_match->execute();
$insertion_top_match->closeCursor();
if($insertion_top_match)
{
echo '<br />Le top match à bien été ajouter';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
else
{
echo '<h3><font color="#ff0000"><b>Le top match à pas plus être ajouter</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
}
}
}
else
{
echo '<h3><font color="#ff0000"><b>l\'image à une taille trop grande,l\'image doit faire une taille de 100x100 merci</b></h3></font>';
header('Refresh: 2;url=ajouter_un_top_match.html#fieldset_center');
}
}
}
}
?>
et l'érreur que je reçois :Warning: getimagesize(logo1.gif) [function.getimagesize]: failed to open stream: No such file or directory in /home/teamsogames/www/admin/add_top.php on line 93
merci