je fais la partie administrateur d'un site, je souhaite faire en sorte d'accéder à différents album photo contenu dans un dossier:
<?php
$dossierphoto=opendir("../photo_galerie");//ouvre le dossier contenant tous les albums
while ($album = readdir($dossierphoto)) {
if ($album != "." && $album != "..") {
echo "<tr><td align=\"right\">
<a href=\"gestion-photo.php?album=$album\" rel=\"prettyPhoto\">
<img src=\"images.jpg\" height=\"100\">
</a></td></tr>\n";
echo"$album";
}
}
?>
jusque là tout vas bien.
Ensuite je souhaite ouvrir mon album et avoir accées au photo qu'il contient:
<?php
$dossiercourant=opendir("../$album");//ouvre l'album
while ($file = readdir($dossiercourant)) {
if ($file != "." && $file != "..") {
echo "<tr><td align=\"right\">
<a href=\"../photo_galerie/$file\" rel=\"prettyPhoto\">
<img src=\"../photo_galerie/$file\" height=\"100\">
</a></td>\n";
echo "<td><a href=\"supprime-photo.php?delfile=$file\"><img src=\"corbeille.gif\" border=\"0\" alt=\"Supprimez le fichier\"></a></td></tr>\n";
}
}
?>
Mais là rien ne va plus!!!! voici les erreurs:
Warning: opendir(../photo initiale) [function.opendir]: failed to open dir: No such file or directory in /homez.41/nancydan/www/admin2/gestion-photo.php on line 30
Warning: readdir(): supplied argument is not a valid Directory resource in /homez.41/nancydan/www/admin2/gestion-photo.php on line 31