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
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
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?
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:
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;
}
?
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
, 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
: 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
: 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
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
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
28 matches
Mail list logo