PDA

View Full Version : <PHP> is_dir() not working for me!


BigCheeZ
06-04-2005, 08:25 AM
I am having a problem with my flash and php stuff. I am making a menu where it has the sub folders of a particular folder displayed. Here is the problem:

I send the relative address of the folder to be looked in (for sub folders) from flash to a php page. The php page then uses is_dir() and readdir(), etc to get the folders. When I send an address that has more than one '/' in it, it does not work. For example:

if i send 'folder1' and in the php it is is_dir("../news/$param") **$param is folder1** it will work fine. But if i send it '../news/folder1' and then use is_dir($param) it will not work. It is the exact same thing! I even tried using split() to split the parameter at every '/' and then reassemble it with a for looping and adding my own '/'. This is just so frustrating b/c if i hard code the address in the is_dir() then it works but if i send in the same thing it will not. I know it is sending the right thing as well since I have printed it out many times to make sure it was right.

madgett
06-04-2005, 07:45 PM
I am having a problem with my flash and php stuff. I am making a menu where it has the sub folders of a particular folder displayed. Here is the problem:

I send the relative address of the folder to be looked in (for sub folders) from flash to a php page. The php page then uses is_dir() and readdir(), etc to get the folders. When I send an address that has more than one '/' in it, it does not work. For example:

if i send 'folder1' and in the php it is is_dir("../news/$param") **$param is folder1** it will work fine. But if i send it '../news/folder1' and then use is_dir($param) it will not work. It is the exact same thing! I even tried using split() to split the parameter at every '/' and then reassemble it with a for looping and adding my own '/'. This is just so frustrating b/c if i hard code the address in the is_dir() then it works but if i send in the same thing it will not. I know it is sending the right thing as well since I have printed it out many times to make sure it was right.

Have you tried putting quotes is_dir("$param") ?

BigCheeZ
06-04-2005, 10:28 PM
ya i tried that, i fixed by finally using split inside flash (b/c the php split would not split "hey/hey/hey" at every '/' like i asked but flash would. The php split would not work only when i sent in info, when i tried it with a hard coded "hey/hey/hey" it worked fine). After using split in flash i sent the array to php and then used a loop to reassemble it. I don't know what the problem is but it is very aggrivating. I am using PHPObject to pass the info by they way.

madgett
06-04-2005, 10:33 PM
You could also check whether the strings were escaped, which would mess up php's split, you could do an echo on the incoming string to double check.