Is there a way to make readdir output filenames alphabetically?
Thanks,
Ed
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
Hi,
I'm creating a file browsing site but don't know how to list properly
filenames containing accents (french, spanish, etc). I've been
browsing the archives but couldn't find a fix.
foreach ($files as $file) {
echo $file;
}
For example:
Filename: sábado-1.mov
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
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
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
Hi there,
does anybody know how to get all file names from a specified directory into an
array?
Thanx,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
))) {
if ($file != . $file != ..) {
echo $file\n;
}
}
closedir($handle);
}
?
-Original Message-
From: Merlin [mailto:[EMAIL PROTECTED]
Sent: 01 April 2005 12:32
To: php-general@lists.php.net
Subject: [PHP] getting filenames from dir
Hi there,
does
Message-
From: Merlin [mailto:[EMAIL PROTECTED]
Sent: 01 April 2005 12:32
To: php-general@lists.php.net
Subject: [PHP] getting filenames from dir
Hi there,
does anybody know how to get all file names from a specified directory into
an
array?
Thanx,
Merlin
--
PHP General
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
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 name. Anyone know a fix for this
please?
- Vic
__
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
Hiow can i do 2 hide the real Filename / Url of a file?
Ive seen it donde in lots of places...
i need this 2 show some images and hide the real Location of them
Anyone can help me?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
I'll note that the erroneous command is the is_dir($file).. this causes
the problem.
Mike
Mike Eheler wrote:
Consider this code for traversing through a directory structure:
?php
function traverse($path='.') {
$path = realpath($path);
$dir = opendir($path);
echo \nDirectory
Ahh forget it .. I figured it out
change to is_dir($path/$file).. *smack*
ignore this altogether
mike
Mike Eheler wrote:
Consider this code for traversing through a directory structure:
?php
function traverse($path='.') {
$path = realpath($path);
$dir = opendir($path);
echo
Spitler [Vice President]
Web Hut Design, Inc.
c 704-451-1324
mailto:[EMAIL PROTECTED]
-Original Message-
From: news.php.net [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] read filenames from dir
hi,
I want to read
Hi!
I wanted to get a txt files in a dircetory, I wrote the script using
opendir and readdir functions. But now I would like to sort the files
while I read them in. how could I solve this problem?
Greetings,
Johannes Rumpf
--
PHP General Mailing List
more files
{
get file name
$arrFilenames[] = $filename;
}
$arrFilenames = array_sort($arrFilenames);
-Stewart;
-Original Message-
From: Johannes Rumpf [mailto:[EMAIL PROTECTED]]
Sent: 28 April 2001 13:43
To: [EMAIL PROTECTED]
Subject: [PHP] sorting filenames using opendir
37 matches
Mail list logo