Re: [PHP] alphabetical filenames with readdir

2008-08-25 Thread Ed Curtis
Ed Curtis wrote: Is there a way to make readdir output filenames alphabetically? Thanks, Ed Never mind. I figured out how to do it using an array and sort. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] alphabetical filenames with readdir

2008-08-25 Thread tedd
At 10:45 AM -0400 8/25/08, Ed Curtis wrote: Is there a way to make readdir output filenames alphabetically? Thanks, Ed Sure -- put the results in an array and then sort() or natsort() it. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-04-03 Thread Rahul Sitaram Johari
Ave, I understand what you're saying, and logically I guess I need to validate $F and verify if it contains a concoction of what I want to be publicly accessible, and nothing else. Is there any other suggestions you can provide in helping secure this flaw?

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Rahul Sitaram Johari
Ave, This Works!!! ?php foreach (glob(vox/.$row['PHONE'].*.vox) as $value) { echo OPTION VALUE='takekey_download.php?F=vox/.basename($value).'.basename($value). /option; } ? Dug up glob() in the manual, followed examples and details ­ works like a charm! Full code:

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Jochem Maas
Rahul Sitaram Johari wrote: Ave, ... VALUE='takekey_download.php?F=vox/.basename($value).'.basename($value). show us the code for takekey_download.php, we may be able to save you on a major security issue with regard to the way you use the F get parameter. /option; } ?

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Tijnema !
On 3/30/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, This Works!!! ?php foreach (glob(vox/.$row['PHONE'].*.vox) as $value) { echo OPTION VALUE='takekey_download.php?F=vox/.basename($value).'.basename($value). /option; } ? Dug up glob() in the manual, followed examples

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Rahul Sitaram Johari
Tijnema, In fact this same Question popped into my head - which one should I choose and why to choose one over the other? I tried both of the codes and compared them. While I can't comment on any security benefits of using either, I have to say, I did find glob() to be slightly faster in

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Rahul Sitaram Johari
Ave, You will probably find this code pretty inefficient, although it works flawlessly, but I ran into a problem with Internet Explorer 7, which instead of giving the Save as dialog box, tried opening the file within the Internet Explorer 7 window and displayed millions of bizarre characters on

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Tijnema !
On 3/30/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote: Ave, You will probably find this code pretty inefficient, although it works flawlessly, but I ran into a problem with Internet Explorer 7, which instead of giving the Save as dialog box, tried opening the file within the Internet

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Jochem Maas
Rahul Sitaram Johari wrote: Ave, You will probably find this code pretty inefficient, although it works flawlessly, but I ran into a problem with Internet Explorer 7, which instead of giving the Save as dialog box, tried opening the file within the Internet Explorer 7 window and displayed

Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-03-30 Thread Rahul Sitaram Johari
Ave, I'll add the Checking stuff immediately - I guess that was really just laziness on my part to get the job done. I'll make sure he's being a good dog and behaving himself ;) Will definitely get rid of '@'. Still not sure, as Tijnema pointed, if this is the most secure way to do this. I'm

Re: [PHP] duplicate filenames but different .extention

2005-12-19 Thread Dragan Stanojevic - Nevidljivi
matt VanDeWalle wrote: hello again I am trying to figure out how i can read the list of files in a directory using the opendir() and readdir() functions. Normally this goes fine but within the loop, what i am wanting to do is echo the filename if it is a jpg file, but if its a .gif, just

Re: [PHP] duplicate filenames but different .extention

2005-12-18 Thread Curt Zirzow
On Sun, Dec 18, 2005 at 05:12:33PM -0600, matt VanDeWalle wrote: hello again I am trying to figure out how i can read the list of files in a directory using the opendir() and readdir() functions. Normally this goes fine but within the loop, what i am wanting to do is echo the filename if it

Re: [PHP] duplicate filenames but different .extention

2005-12-18 Thread Philip Hallstrom
hello again I am trying to figure out how i can read the list of files in a directory using the opendir() and readdir() functions. Normally this goes fine but within the loop, what i am wanting to do is echo the filename if it is a jpg file, but if its a .gif, just continue. I have several

Re: [PHP] getting filenames from dir

2005-04-01 Thread Jesper Goos
Try this function: function scandir($dirstr){ $files = array(); $fh = opendir($dirstr); while (false !== ($filename = readdir($fh))){ array_push($files, $filename);} closedir($fh); return $files; } return an array with all

RE: [PHP] getting filenames from dir

2005-04-01 Thread Stanislav Kuhn
HI... Do you read php manual sometimes? ;o) just replace echo $file\n; by $my_file_array[]=$file; readdir (PHP 3, PHP 4 , PHP 5) readdir -- read entry from directory handle Description string readdir ( resource dir_handle) Returns the filename of the next file from the directory. The

Re: [PHP] getting filenames from dir

2005-04-01 Thread Vaibhav Sibal
And does one manage recursive sub directories for the same thing ? On Apr 1, 2005 3:38 AM, Stanislav Kuhn [EMAIL PROTECTED] wrote: HI... Do you read php manual sometimes? ;o) just replace echo $file\n; by $my_file_array[]=$file; readdir (PHP 3, PHP 4 , PHP 5) readdir -- read

Re: [PHP] getting filenames from dir

2005-04-01 Thread Mario St-Gelais
That should get you started : $dirname='/var'; $dh=opendir($dirname) or die('could not open directory'); while (!(($file=readdir($dh))===false)){ if (is_dir('$dirname/$file')){ $myarray[]=$file; } echo $filebr; $myarray[]=$file; } Mario Merlin wrote: Hi there, does anybody know

Re: [PHP] + in filenames

2003-02-03 Thread Marek Kilimajer
That double quote is escaped [EMAIL PROTECTED] wrote: On Fri, 31 Jan 2003, Marek Kilimajer wrote: I use this: $name=strtr( $name, ?*#$%^:+=/\, __); I'm hoping that double quote was a typo?? Ed -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] + in filenames

2003-02-03 Thread ed
I'll be the first to admit I was wrong and missed that. This will work out great for me. I'm writting scripts for Realtors to upload photos to us via the web and you can only imagine what these people will include in a filename. Ed On Mon, 3 Feb 2003, Marek Kilimajer wrote: That double

Re: [PHP] + in filenames

2003-01-31 Thread Marek Kilimajer
that has the + character in it's name. - Vic -Original Message- From: Richard Whitney [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 5:32 PM To: Victor Cc: [EMAIL PROTECTED] Subject: RE: [PHP] + in filenames Victor! What are you trying to accomplish? Do you want to preserve

Re: [PHP] + in filenames

2003-01-31 Thread ed
On Fri, 31 Jan 2003, Marek Kilimajer wrote: I use this: $name=strtr( $name, ?*#$%^:+=/\, __); I'm hoping that double quote was a typo?? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] + in filenames

2003-01-25 Thread Richard Whitney
Some sample code would help, but maybe try urldecode('$filename'); RW Quoting Victor [EMAIL PROTECTED]: ### I have a file upload field, and some filename checking code, but it ### breaks the code whenever a + is inside the filename it verifies space ### and other tags but breaks on + in the

RE: [PHP] + in filenames

2003-01-25 Thread Victor
, 2003 5:12 PM To: Victor Cc: [EMAIL PROTECTED] Subject: Re: [PHP] + in filenames Some sample code would help, but maybe try urldecode('$filename'); RW Quoting Victor [EMAIL PROTECTED]: ### I have a file upload field, and some filename checking code, but it ### breaks the code whenever a + is inside

RE: [PHP] + in filenames

2003-01-25 Thread Richard Whitney
: Saturday, January 25, 2003 5:12 PM ### To: Victor ### Cc: [EMAIL PROTECTED] ### Subject: Re: [PHP] + in filenames ### ### Some sample code would help, but maybe try urldecode('$filename'); ### ### RW ### ### Quoting Victor [EMAIL PROTECTED]: ### ### ### I have a file upload field, and some

RE: [PHP] + in filenames

2003-01-25 Thread Victor
: Richard Whitney [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 25, 2003 5:32 PM To: Victor Cc: [EMAIL PROTECTED] Subject: RE: [PHP] + in filenames Victor! What are you trying to accomplish? Do you want to preserve the original filename? Why not give uploaded files uniformly unique names? In other

RE: [PHP] read filenames from dir

2001-07-26 Thread Phil Spitler
This should do it for you. ? $path = THE DIRECTORY YOU WISH TO LIST THE FILES FROM; $d = dir($path); while ($entry=$d-read()) { if ((!is_dir($path.$entry)) AND ($entry !== .) AND ($entry !== ..)){ echo a href='$entry'$entry/abr\n; } } $d-close(); ? - Phil

RE: [PHP] sorting filenames using opendir and readdir

2001-04-28 Thread Taylor, Stewart
Read them into an array then sort the array. while more files { get file name $arrFilenames[] = $filename; $arrFilenames = array_sort($arrFilenames); } The above sorts the array each time a file is read as you requested, however its more efficient to read them all in then sort while