Re: [PHP] Readdir() question

2008-09-12 Thread Luke
When I need to do 'filesystem' type things I use MySQL to map all of the files. This offers lot's of versatility in that you could just make a single folder called filesystem and have all of your files in the root of that folder - then use mysql to map virtual folders and structures and such.

Re: [PHP] Readdir() question

2008-09-12 Thread Jochem Maas
Luke schreef: When I need to do 'filesystem' type things I use MySQL to map all of the files. This offers lot's of versatility in that you could just make a single folder called filesystem and have all of your files in the root of that folder - then use mysql to map virtual folders and

Re: [PHP] Readdir() question

2008-09-12 Thread Luke
Ok, one folder on your webserver, and put all of the files that you want to include on your website/system in this folder (also uploading into this folder); just in the root of that folder, so say you wouldn't have anymore folders under it. Make a table called 'Files,' containing: ID Name Type

Re: [PHP] Readdir() question

2008-09-12 Thread Nathan Rixham
Luke wrote: Ok, one folder on your webserver, and put all of the files that you want to include on your website/system in this folder (also uploading into this folder); just in the root of that folder, so say you wouldn't have anymore folders under it. Make a table called 'Files,' containing:

RE: [PHP] Readdir() question

2008-09-12 Thread Boyd, Todd M.
-Original Message- From: Luke [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2008 7:13 AM To: Jochem Maas Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: Re: [PHP] Readdir() question Ok, one folder on your webserver, and put all of the files that you want

Re: [PHP] Readdir() question

2008-09-11 Thread Stut
On 11 Sep 2008, at 13:12, Ben Stones wrote: I'm going to make a small browser based file system for ease of small updates that I make frequently on my Website. First of all I want to loop all the files on the same directory and to tell PHP read the same directory, I think I'd need to use the

RE: [PHP] Readdir() question

2008-09-11 Thread Jay Blanchard
[snip] I'm going to make a small browser based file system for ease of small updates that I make frequently on my Website. First of all I want to loop all the files on the same directory and to tell PHP read the same directory, I think I'd need to use the magic constant I think its called, __DIR__

Re: [PHP] Readdir() question

2008-09-11 Thread Jochem Maas
Ben Stones schreef: Hi, I'm going to make a small browser based file system for ease of small updates that I make frequently on my Website. First of all I want to loop all the files on the same directory and to tell PHP read the same directory, I think I'd need to use the magic constant I think

Re: [PHP] Readdir() question

2008-09-11 Thread Nathan Rixham
Stut wrote: On 11 Sep 2008, at 13:12, Ben Stones wrote: I'm going to make a small browser based file system for ease of small updates that I make frequently on my Website. First of all I want to loop all the files on the same directory and to tell PHP read the same directory, I think I'd need

Re: [PHP] Readdir() question

2008-09-11 Thread Jochem Maas
Nathan Rixham schreef: Stut wrote: On 11 Sep 2008, at 13:12, Ben Stones wrote: I'm going to make a small browser based file system for ease of small updates that I make frequently on my Website. First of all I want to loop all the files on the same directory and to tell PHP read the same

Re: [PHP] Readdir() question

2008-09-11 Thread Nathan Rixham
Jochem Maas wrote: Nathan Rixham schreef: Stut wrote: maybe this is into coding standards and ethics.. but this may be acceptable: if( !defined('__DIR__') ) { define('__DIR__' , dirname(__FILE__)); } however realistically you'd have to do this in every file and nto just in one include

Re: [PHP] Readdir() question

2008-09-11 Thread Jochem Maas
Nathan Rixham schreef: Jochem Maas wrote: Nathan Rixham schreef: Stut wrote: maybe this is into coding standards and ethics.. but this may be acceptable: if( !defined('__DIR__') ) { define('__DIR__' , dirname(__FILE__)); } however realistically you'd have to do this in every file and nto

RE: [PHP] Readdir

2006-11-28 Thread Vincent DUPONT
If you are working in pure PHP5 OOP, you could like to try the new SPL iterators. see http://www.phpro.org/tutorials/Introduction-to-SPL.html#12 vincent -Original Message- From: Tom Chubb [mailto:[EMAIL PROTECTED] Sent: Tue 28/11/2006 9:55 To: [php] PHP General List Subject: [PHP]

Re: [PHP] Readdir

2006-11-28 Thread Jochem Maas
Tom Chubb wrote: What would be the best way to retrieve a list of files from an upload folder that are called id where the extension could be .doc .txt or .pdf For example, I have a folder where people can upload a document and the document is renamed as their user id. They can upload a PDF,

Re: [PHP] Readdir

2006-11-28 Thread Børge Holen
something like this? while ( gettype ( $file = @readdir (@opendir ( $dirname )) ) != boolean ){ check if correct extension, else - something completely else? } On Tuesday 28 November 2006 09:55, Tom Chubb wrote: What would be the best way to retrieve a list of files from an upload

RE: [PHP] Readdir

2006-11-28 Thread Vincent DUPONT
:[EMAIL PROTECTED] Sent: Tue 28/11/2006 10:59 To: Tom Chubb Cc: [php] PHP General List Subject: Re: [PHP] Readdir Tom Chubb wrote: What would be the best way to retrieve a list of files from an upload folder that are called id where the extension could be .doc .txt or .pdf For example, I have

Re: [PHP] Readdir

2006-11-28 Thread Tom Chubb
){ $pics[]=$filename; } vincent -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tue 28/11/2006 10:59 To: Tom Chubb Cc: [php] PHP General List Subject: Re: [PHP] Readdir Tom Chubb wrote: What would be the best way to retrieve

Re: [PHP] Readdir

2006-11-28 Thread Tom Chubb
) as $filename){ $pics[]=$filename; } vincent -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tue 28/11/2006 10:59 To: Tom Chubb Cc: [php] PHP General List Subject: Re: [PHP] Readdir Tom Chubb wrote: What would be the best way

Re: [PHP] Readdir

2006-11-28 Thread Jochem Maas
Subject: Re: [PHP] Readdir Tom Chubb wrote: What would be the best way to retrieve a list of files from an upload folder that are called id where the extension could be .doc .txt or .pdf For example, I have a folder where people can upload a document and the document is renamed

RE: [PHP] readdir

2006-09-15 Thread Brad Fuller
According to php.net, the readdir() function simply reads the contents of the directory in the order which they are stored by the filesystem. One way to force the order would be to loop through the contents of the directory and store the directory names into an array, and use the functions

Re: [PHP] readdir

2006-09-15 Thread Richard Lynch
On Fri, September 15, 2006 2:18 pm, Toby Osbourn wrote: I suppose my question put simply is, what is the default ordering of directories when PHP uses the readdir method? Whatever order the OS decides to use. In practice, it's whatever is convenient for that particular file system. So FAT,

Re: [PHP] readdir

2006-09-15 Thread Larry Garfield
On Friday 15 September 2006 14:18, Toby Osbourn wrote: I suppose my question put simply is, what is the default ordering of directories when PHP uses the readdir method? And is there anyway to force a specific ordering to the directories before PHP searches down them? If you're on PHP 5, look

Re: [PHP] readdir() question

2006-08-16 Thread Richard Lynch
On Tue, August 15, 2006 11:00 pm, John Meyer wrote: Richard Lynch wrote: Do you really mean opendir() or do you mean readdir() ??? readdir(). The point is why do you need to put it as !== vs. != http://us3.php.net/manual/en/language.types.type-juggling.php -- Like Music?

Re: [PHP] readdir() question

2006-08-15 Thread Tom Chubb
On 15/08/06, John Meyer [EMAIL PROTECTED] wrote: I have a script to list the files in a directory: select name=letters ?php $open = opendir(.); while ($file = readdir($open) != false) { ? option value=?=$file??=$file?/option ?php } ? /select /form And all I am

Re: [PHP] readdir() question

2006-08-15 Thread Richard Lynch
On Tue, August 15, 2006 12:04 pm, John Meyer wrote: I have a script to list the files in a directory: select name=letters ?php $open = opendir(.); while ($file = readdir($open) != false) { ? option value=?=$file??=$file?/option ?php } ? /select /form And all

Re: [PHP] readdir() question

2006-08-15 Thread John Meyer
Richard Lynch wrote: On Tue, August 15, 2006 12:04 pm, John Meyer wrote: I have a script to list the files in a directory: select name=letters ?php $open = opendir(.); while ($file = readdir($open) != false) { ? option value=?=$file??=$file?/option ?php } ? /select

Re: [PHP] readdir() question

2006-08-15 Thread Richard Lynch
On Tue, August 15, 2006 5:56 pm, John Meyer wrote: Richard Lynch wrote: On Tue, August 15, 2006 12:04 pm, John Meyer wrote: I have a script to list the files in a directory: select name=letters ?php $open = opendir(.); while ($file = readdir($open) != false) { ? option

Re: [PHP] readdir() question

2006-08-15 Thread John Meyer
Richard Lynch wrote: Do you really mean opendir() or do you mean readdir() ??? readdir(). The point is why do you need to put it as !== vs. != -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] readdir() question

2006-08-15 Thread Chris
John Meyer wrote: Richard Lynch wrote: Do you really mean opendir() or do you mean readdir() ??? readdir(). The point is why do you need to put it as !== vs. != They mean different things. !== means check the values are not the same AND check their types. != means check the values

RE: [PHP] readdir problem with white spaces

2006-06-15 Thread Jay Blanchard
[snip] When I read the directory, if the file has more than one white spaces, readdir only return me the file with one space ... so if I have on the file system . ROAD 1 005.JPG or ROAD1 0005.JPG php readdir return me ROAD 1 005.JPG!! [/snip] Additional white space is

RE: [PHP] readdir and mime types

2005-11-22 Thread Jay Blanchard
[snip] I'm attempting to read a list of files in a directory using readdir() but am having problems with mpeg files not seemingly being read. Cope snippet: $count = 0; while (false !== ($file = readdir($open_dir))) { if ($file != '.' $file != '..') {

Re: [PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
On 11/22/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I'm attempting to read a list of files in a directory using readdir() but am having problems with mpeg files not seemingly being read. Cope snippet: $count = 0; while (false !== ($file = readdir($open_dir)))

RE: [PHP] readdir and mime types

2005-11-22 Thread Jay Blanchard
[snip] Yes $open_dir is the handle from opendir(). The file_exists is simply checking for an associated file elsewhere as I'm looking for video files and thumbnails. As I said, this works fine for avi suffixed files but not mpg or mpeg suffixed files. [/snip] Make sure to always hit reply-all,

Re: [PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
[snip] Make sure to always hit reply-all, or the e-mail will not go back to the list. Yep, realised that after hitting 'send'. :-( If file exists is looking for an associated files is it probable that the .mpg files do not have one associated with it in the other directory? It is probable,

Re: [PHP] readdir and mime types

2005-11-22 Thread David Grant
Graham, Is safe mode enabled in your config file? If safe mode is on, PHP will check the file to ensure it is owned by the same user executing the script. If this condition fails, file_exists() will not work on the file. http://php.net/file_exists

RE: [PHP] readdir and mime types

2005-11-22 Thread Jay Blanchard
[snip] If file exists is looking for an associated files is it probable that the .mpg files do not have one associated with it in the other directory? It is probable, that's why the check is there, but in this case the associated file(s) definitely does exist. If I simply change the file

Re: [PHP] readdir and mime types

2005-11-22 Thread Graham Cossey
[snip all] OK, of course it's my fault !! :o My directory variables are using relative paths and I was trying to access the parent directory from the sub-directory but not using '..' Sorry. Thanks for your help. -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] readdir and mime types

2005-11-22 Thread Richard Lynch
On Tue, November 22, 2005 8:23 am, Graham Cossey wrote: I'm attempting to read a list of files in a directory using readdir() but am having problems with mpeg files not seemingly being read. Cope snippet: $count = 0; while (false !== ($file = readdir($open_dir))) {

Re: [PHP] readdir behavior I cannot understand

2004-09-20 Thread Jason Wong
On Monday 20 September 2004 11:44, Jason FB wrote: Hereis my script, I copied and pasted Example 1 from this page: http://us4.php.net/manual/en/function.readdir.php You will see that the only way that I changed I initialize two variables at the very top that set the directory of the

Re: [PHP] readdir() output question

2002-12-13 Thread Matt Vos
$img_count = 0; echo( table tr td colspan=5My Images/td): (loop through filenames) { if (($img_count % 5) == 0) echo( /trtr); echo( tdimg_src=\$filename\/td); $img_count = $img_count + 1; } while (($img_count % 5) != 0) { echo( tdnbsp;/td); } echo( /tr /table) Matt RClark

RE: [PHP] Readdir

2002-08-01 Thread Matt Schroebel
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 01, 2002 2:54 PM To: [EMAIL PROTECTED] Subject: [PHP] Readdir New To Php so please bear with me... :) I used the readdir function to read the files listed on a Apache server. And it worked fine. Now I would

Re: [PHP] Readdir

2002-08-01 Thread Nicole Lallande
Change: echo $file\n; to: echo a href='$file'$file/a\n; Note the nested quotes -- outer quotes - , inner quotes (around $file) single - ' Best, Nicole [EMAIL PROTECTED] wrote: New To Php so please bear with me... :) I used the readdir function to read the files listed on a Apache server.

Re: [PHP] Readdir

2002-08-01 Thread Jason Wong
On Friday 02 August 2002 02:53, [EMAIL PROTECTED] wrote: New To Php so please bear with me... :) I used the readdir function to read the files listed on a Apache server. And it worked fine. http://www.optimus7.com/findme.php is the result I get from the php code below. Help! ?php if

Re: [PHP] Readdir

2002-08-01 Thread Danny wall
?php if ($handle = opendir('/my/directory')) { echo Directory handle: $handle\n; echo Files:\n; while (false !== ($file = readdir($handle))) { echo $file\n; } Everything is good, you just to make a slight addition to your echo. echo a href=\$file\$file/aP -Danny