[PHP] Having an issue with a Directory Listing in the php Scripting
I was wondering if I could get alittle help in this issue. I have extinguished all other resources, with no avail to help. I am trying to get a directory listing for a dropdown list to choose for connection to a MySQL database for the correct image name to be printed into the database. I have the database part working perfectly as far as the printing the correct name from the directory list, although I am only being able to list the first file in each of the directories. Not the entire directory. This is in a .inc script running with two other scripts a .php script and another .inc script for the reference to the following. I was wondering if someone could give me some insight as to how I could resolve this issue to make the list actually appear like it is supposed to displaying everything in the list that has the extension '.jpg', '.JPG', '.gif', '.GIF', '.bmp', '.BMP', '.jpeg', '.JPEG'. Although, the only files I really need out of the directory are going to be '.JPG', '.jpg', '.GIF', '.gif', '.JPEG', '.jpeg'. some assistance would be greatly appreciated.. the following is the actual script as I have written it. /* The Script segment that is needed to be fixed or working */ if ($dir1 = opendir(../../members_profiles/pics/)) { while(FALSE !== ($file = readdir($dir1))) { if ($file != . $file != ..) { $fdd[picture] = Array( 'name'='Picture', 'select'='D', 'type'='string', 'maxlen'=130, 'nowrap'=false, 'values'=Array($file), 'default'='no_image.jpg', 'required'=true, 'sort'=true ); } } closedir($dir1); } if ($dir2 = opendir(../../members_profiles/crests/)) { while(FALSE !== ($files = readdir($dir2))) { if ($files != . $files != ..) { $fdd[crest] = Array( 'name'='Crest', 'select'='D', 'type'='string', 'maxlen'=130, 'nowrap'=false, 'values'=Array($files), 'default'='no_image.jpg', 'required'=true, 'sort'=true ); } } closedir($dir2); } /* the web page that this is running on is http://www.dragonpalace.net/~dfwshinai/members_profiles although, the script is actually resident in the admin pages of this site. */ Thanks in advance §§ Duncan MacLeod §§ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Having an issue with a Directory Listing in the php Scripting
On Fri, Aug 09, 2002 at 08:58:41AM -0500, §§ Duncan MacLeod §§ wrote: I am only being able to list the first file in each of the directories. Not the entire directory. ... snip ... Although, the only files I really need out of the directory are going to be '.JPG', '.jpg', '.GIF', '.gif', '.JPEG', '.jpeg'. While this doesn't do exactly what your script does, it will point you in the right direction... ?php $DirHandle=opendir('.'); while ($FileName = readdir($DirHandle)) { switch ( substr($FileName, -4) ) { case '.jpg': case '.JPG': case 'jpeg': case 'JPEG': case '.gif': case '.GIF': $FileList[] = $FileName; break; } } # Sort the list alphabetically: asort($FileList); echo 'ul'; while (list(,$Name) = each($FileList) ) { echo lia href=\$Name\$Name/a/li\n; } echo '/ul'; ? -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Having an issue with a Directory Listing in the php Scripting
it seems as though this wold work great if I had the script running in a actual php.. the initial file is index.php but calls to indexcontent.inc that calls to another inc file that has the actual content info in it. maybe it would help if put a copy of the inc file and a copy of the php files.. ?? anyhow if anyone else cares to help it would be great unless the original Daniel would like to try this one out.. lol.. let me know it is greatly appreciated. §§ Duncan MacLeod §§ Analysis Solutions [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Fri, Aug 09, 2002 at 08:58:41AM -0500, §§ Duncan MacLeod §§ wrote: I am only being able to list the first file in each of the directories. Not the entire directory. ... snip ... Although, the only files I really need out of the directory are going to be '.JPG', '.jpg', '.GIF', '.gif', '.JPEG', '.jpeg'. While this doesn't do exactly what your script does, it will point you in the right direction... ?php $DirHandle=opendir('.'); while ($FileName = readdir($DirHandle)) { switch ( substr($FileName, -4) ) { case '.jpg': case '.JPG': case 'jpeg': case 'JPEG': case '.gif': case '.GIF': $FileList[] = $FileName; break; } } # Sort the list alphabetically: asort($FileList); echo 'ul'; while (list(,$Name) = each($FileList) ) { echo lia href=\$Name\$Name/a/li\n; } echo '/ul'; ? -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution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1*)^]I6!P_IA?: M\=SEY?E:^5JD]6L_ VCWXH3U%U7#\T$1 NO,\1.,]-55O(+\LA/X'[
Re: [PHP] Having an issue with a Directory Listing in the php Scripting
Hi Duncan: On Fri, Aug 09, 2002 at 04:14:47PM -0500, §§ Duncan MacLeod §§ wrote: it seems as though this wold work great if I had the script running in a actual php.. the initial file is index.php but calls to indexcontent.inc that calls to another inc file that has the actual content info in it. Where the script is doesn't matter. You could include 5 billion layers deep and the operation I sent you will still work the same. Regardless, the point of my code was to show you the direction you need to start thinking in to properly read a directory and extract the names of the files you're looking for. If what I showed you doesn't suit your needs, then tweak things in your script and/or my script until they do. If there's a part of the example you don't understand, go to the manual and check it out. From what I quickly saw of your large script in your first posting, it seemed WAY overly complex for the simple task at hand. maybe it would help if put a copy of the inc file and a copy of the php files.. Not really. The likelyhood of someone wanting to read huge chunks of code is low. Especially when it's base64 encoded. Posting such stuff (let alone top posting w/o removing irrelevant parts of prior posts) to the list wastes a lot of bandwith and disk storage space. Later, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php