Interrogation à propos de file_exists
Bonjour à tous !
Ci-dessous un code tout simple
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
<?php
if (isset($_POST['validation']) and $_POST['validation']=="ok")
{
if (file_exists($_FILES['picture']['tmp_name']))
{
$msg='<p><span style="color:#0f0;">Fichier existe</span></p>';
}
else
{
$msg='<p><span style="color:#f00;">Fichier manquant</span></p>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body id="addpict">
<h1>Ajouter image</h1>
<?php
if (!empty($msg)) { echo $msg; }
?>
<form action="add-picture-test.php" method="post" enctype="multipart/form-data">
<p>
<label for="picture">Image :</label>
<input type="file" id="picture" name="picture" />
</p>
<p>
<input type="submit" id="submit" name="submit" value="Envoyer" />
<input type="hidden" id="validation" name="validation" value="ok" />
</p>
</form>
</body>
</html> |
Dans mon environnement local (WAMP) et sur un hébergement mutualisé OVH, le comportement du script est normal, à savoir :
- si champ pas complété, le message "Fichier manquant" apparaît
- si champ complété, le message "Fichier existe" apparaît
Par contre, sur un autre hébergement (Win NT/IIS/PHP), que je remplisse ou non le champ du formulaire, c'est toujours le message "Fichier manquant" qui est renvoyé.
Je suis certainement passé à côté de quelque chose en cherchant la solution est là, je dois dire que je ne sais plus où regarder.
Donc, si vous, qui passez par ici, avez le moindre élément de réponse à me donner, n'hésitez surtout pas!
Merci d'avance.