Php savoir si un fichier existe...

Fermé
kurp - 21 mars 2001 à 10:36
 Ceri Hankey - 24 mars 2001 à 19:09
comment savoir en PHP si un fichier existe sur le systeme ?

je veux arriver à qq chose du genre :

si (fichier toto.txt==true)
{
faire ça
}

sinon
{
faire ça
}

Si qq peut m'apporter une reponse.... merci
A voir également:

1 réponse

Ceri Hankey
24 mars 2001 à 19:09
Sous Linux - Apache le suivant fonctionne pour moi...


<?
$tfile = "PGtest.php";

echo ("<P>File request is for $tfile </P>");

if (file_exists("PGtest.php")) {
echo ("<P>File '$tfile' exists </P>");
} else {
echo ("<P>File '$tfile' does not exist </P>");
}
?>
37