RE: [PHP] Trying to list a directory content HELP PLEASE
Hey Scott, that at least helped me to find out what is going wrong. When I use the code as you told me... $fd=readdir(/home/casapu/paginas /image/caterleras/); if (!$fd) die (Can't read dir); It gives me: Warning: Supplied argument is not a valid Directory resource in /home/casapu/paginas/mbt/php/dir.php on line 7 Can't read dir So I'm assuming is not accepting the directory. I have checked the permits, and it has all enabled, read, write and executable. I have tried with the final slash, and without it, and so far it keeps giving me that message... any ideas? -Mensaje original- De: Scott Hurring [mailto:[EMAIL PROTECTED]] Enviado el: Jueves, 06 de Junio de 2002 15:26 Para: '[EMAIL PROTECTED]' Asunto: RE: [PHP] Trying to list a directory content HELP PLEASE Instead of chdir() try putting the path directly into readdir(); it'll make the code a tiny bit cleaner. readdir(/home/casapu/paginas/images/carteleras); ** and check return values! ** $fd = readdir(...) if (!$fd) die(Cannot readdir); The code you have *should* work, but you'll never know why it's not working if you don't check return statuses --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 3:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Trying to list a directory content HELP PLEASE On Friday 07 June 2002 00:47, webmaster mbtradingco wrote: I know my doubt is probable odd, but I would ask your help please. I need a user to be able to select an image from a directory, from a drop down box. For this I need to list all the images available on the directory, hence, I have this code: select size=1 name=normal1 ?php chdir(/home/casapu/paginas/images/carteleras); $direc = opendir(.); while ($f = readdir($direc)); { print(option value=\.$f.\.$f./option); } ? ./select); but this is not working. I have reviewed the code against all the manuals/books I have, and it says it should work but it doesn't. Anyone knows what I'm doing wrong? how doesn't it work? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Fashions have done more harm than revolutions. -- Victor Hugo */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trying to list a directory content HELP PLEASE
Is that a space in the directory path? I think you will have to use opendir() function first. opendir: Returns a directory handle to be used in subsequent closedir(), readdir(), and rewinddir() calls. The manual has some good examples. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] t]On Behalf Of webmaster mbtradingco Sent: Thursday, June 06, 2002 3:56 PM To: 'Scott Hurring' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Trying to list a directory content HELP PLEASE Hey Scott, that at least helped me to find out what is going wrong. When I use the code as you told me... $fd=readdir(/home/casapu/paginas /image/caterleras/); if (!$fd) die (Can't read dir); It gives me: Warning: Supplied argument is not a valid Directory resource in /home/casapu/paginas/mbt/php/dir.php on line 7 Can't read dir So I'm assuming is not accepting the directory. I have checked the permits, and it has all enabled, read, write and executable. I have tried with the final slash, and without it, and so far it keeps giving me that message... any ideas? -Mensaje original- De: Scott Hurring [mailto:[EMAIL PROTECTED]] Enviado el: Jueves, 06 de Junio de 2002 15:26 Para: '[EMAIL PROTECTED]' Asunto: RE: [PHP] Trying to list a directory content HELP PLEASE Instead of chdir() try putting the path directly into readdir(); it'll make the code a tiny bit cleaner. readdir(/home/casapu/paginas/images/carteleras); ** and check return values! ** $fd = readdir(...) if (!$fd) die(Cannot readdir); The code you have *should* work, but you'll never know why it's not working if you don't check return statuses --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 3:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Trying to list a directory content HELP PLEASE On Friday 07 June 2002 00:47, webmaster mbtradingco wrote: I know my doubt is probable odd, but I would ask your help please. I need a user to be able to select an image from a directory, from a drop down box. For this I need to list all the images available on the directory, hence, I have this code: select size=1 name=normal1 ?php chdir(/home/casapu/paginas/images/carteleras); $direc = opendir(.); while ($f = readdir($direc)); { print(option value=\.$f.\.$f./option); } ? ./select); but this is not working. I have reviewed the code against all the manuals/books I have, and it says it should work but it doesn't. Anyone knows what I'm doing wrong? how doesn't it work? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Fashions have done more harm than revolutions. -- Victor Hugo */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.363 / Virus Database: 201 - Release Date: 05/21/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.363 / Virus Database: 201 - Release Date: 05/21/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trying to list a directory content HELP PLEASE
On Thu, 6 Jun 2002, webmaster mbtradingco wrote: Hey Scott, that at least helped me to find out what is going wrong. When I use the code as you told me... $fd=readdir(/home/casapu/paginas /image/caterleras/); if (!$fd) die (Can't read dir); It gives me: Warning: Supplied argument is not a valid Directory resource in /home/casapu/paginas/mbt/php/dir.php on line 7 Can't read dir So I'm assuming is not accepting the directory. I have checked the permits, and it has all enabled, read, write and executable. I have tried with the final slash, and without it, and so far it keeps giving me that message... any ideas? Does the directory paginas really have a blank space at the end of the name? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trying to list a directory content HELP PLEASE
I know my doubt is probable odd, but I would ask your help please. I need a user to be able to select an image from a directory, from a drop down box. For this I need to list all the images available on the directory, hence, I have this code: select size=1 name=normal1 ?php chdir(/home/casapu/paginas/images/carteleras); $direc = opendir(.); while ($f = readdir($direc)); { print(option value=\.$f.\.$f./option); } ? ./select); but this is not working. I have reviewed the code against all the manuals/books I have, and it says it should work but it doesn't. Anyone knows what I'm doing wrong? HELP PLEASE VV -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trying to list a directory content HELP PLEASE
On Friday 07 June 2002 00:47, webmaster mbtradingco wrote: I know my doubt is probable odd, but I would ask your help please. I need a user to be able to select an image from a directory, from a drop down box. For this I need to list all the images available on the directory, hence, I have this code: select size=1 name=normal1 ?php chdir(/home/casapu/paginas/images/carteleras); $direc = opendir(.); while ($f = readdir($direc)); { print(option value=\.$f.\.$f./option); } ? ./select); but this is not working. I have reviewed the code against all the manuals/books I have, and it says it should work but it doesn't. Anyone knows what I'm doing wrong? how doesn't it work? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Fashions have done more harm than revolutions. -- Victor Hugo */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Trying to list a directory content HELP PLEASE
Instead of chdir() try putting the path directly into readdir(); it'll make the code a tiny bit cleaner. readdir(/home/casapu/paginas/images/carteleras); ** and check return values! ** $fd = readdir(...) if (!$fd) die(Cannot readdir); The code you have *should* work, but you'll never know why it's not working if you don't check return statuses --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 06, 2002 3:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Trying to list a directory content HELP PLEASE On Friday 07 June 2002 00:47, webmaster mbtradingco wrote: I know my doubt is probable odd, but I would ask your help please. I need a user to be able to select an image from a directory, from a drop down box. For this I need to list all the images available on the directory, hence, I have this code: select size=1 name=normal1 ?php chdir(/home/casapu/paginas/images/carteleras); $direc = opendir(.); while ($f = readdir($direc)); { print(option value=\.$f.\.$f./option); } ? ./select); but this is not working. I have reviewed the code against all the manuals/books I have, and it says it should work but it doesn't. Anyone knows what I'm doing wrong? how doesn't it work? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Fashions have done more harm than revolutions. -- Victor Hugo */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php