Forum Moderators: phranque

Message Too Old, No Replies

file sorting in remote directory

         

oliver_new

11:52 am on Apr 18, 2005 (gmt 0)

10+ Year Member



Hi there, I am completely new to this forum, haven't found anything on the subject, so I try it here. I tried it in the PHP-Forum, they told me to try it here. Any help is appreciated, even if it is just redirection to another thread or forum.

Can anybody tell me how files are sorted in remote directories on an Apache server?

I am working with files and directories in php, having pictures in a directory and let php find and display them automatically. However, the sorting of the pictures is all mixed up, they only seem to be sorted by filename, but are in some cases not. I have experimented with uploading them once again, all in a bunch as well as picture by picture. it gives me various results, I can not recognize any pattern in the sorting.

I am very grateful for any help.

Thanks,
Oliver

sitz

11:06 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



This is really a PHP question, however a quick glance at the PHP documentation for the readdir function [us3.php.net] indicates that it returns the files as ordered by the underlying filesystem. Thus, it will depend on on which filesystem (and, by extension, which OS) you're running your server on. There are also examples on that page for various sorting options.

oliver_new

6:56 am on Apr 19, 2005 (gmt 0)

10+ Year Member



Thanks!

You are right, I never thought the problem could be solved by PHP, I thought it must be the server configuration. Anyway the info on the php website is great, thanks for the hint.

Oliver

coopster

11:32 am on Apr 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



hehe, I just logged on this morning and replied to your PHP thread [webmasterworld.com] with pretty much the same answer as sitz offered here in Apache. Glad you found your way, oliver_new.