Jump to content

Odd bahaviour with opendir and readdir


j0nr

Recommended Posts

Hi folks,

 

First time posting here and a bit of a novice at PHP, but am learning....

 

I am fiddling with a small bit of code to create a very basic php gallery (I'm sure everyone has at some point). I started off with a mysql intergrated one then thought I would try a new one without the mysql.

 

Its working fine but I am just having one very strange problem.

 

Basically, I started of with just /mygallery/index.php?w=... where ... = the location (physical folder) of photos. I use opendir to open the contents of w= and parse whether it is a directory or a file (then narrow it down to just images).

 

If it is a dir, then I present it as a link to that folder (sub-album) if it is a photo, I present a thumb link to the image.

 

Now I have added a mod_rewrite rule to allow my urls to be of the form 'mygallery/album/subalbum'  this gets ocnverted into 'mygallery/index.php?w=album/subalbum'

 

Now the funny bit. If I create a new folder in one of the subalbum, e.g. : mygallery/album/subalbum/<b>New Folder</b> the code works. i.e. when I point my browser at 'mygallery/album/subalbum' I get a link showing 'New Folder'

 

But if I create a new folder of any other NAME it does not appear in the list!! So if I just rename 'New Folder' to 'New Folde' it drops of the web page!!!

 

Now I am really not sure what the hell is going on...

 

Hope someone can help.

 

I will post my code if necessary.

 

Thanks in advance!

 

Jon Reynolds

Link to comment
https://forums.phpfreaks.com/topic/235997-odd-bahaviour-with-opendir-and-readdir/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.