krash11554 Posted September 28, 2012 Share Posted September 28, 2012 i have this glob function. here it is $howmanycarpics = glob(" /garage/uploads/cars/15/thumbs/car1"/*.*"); print_r($howmanycarpics); i think this should return all files in that folder but it isnt Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/ Share on other sites More sharing options...
requinix Posted September 28, 2012 Share Posted September 28, 2012 There's a very big, glaring syntax error in that code. Assuming that's a typo, remove the space from the beginning of the string. Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381474 Share on other sites More sharing options...
krash11554 Posted September 28, 2012 Author Share Posted September 28, 2012 Yea that's now how it is in the real code I must of did thy when pasting the code. I guess that's not the problem Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381475 Share on other sites More sharing options...
Pikachu2000 Posted September 28, 2012 Share Posted September 28, 2012 (edited) My guess is that the path is wrong. What do you get from var_dump( glob("/garage/uploads/cars/15/thumbs/car1"/*.*") ); Edited September 28, 2012 by Pikachu2000 Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381477 Share on other sites More sharing options...
Psycho Posted September 28, 2012 Share Posted September 28, 2012 (edited) Am I the only one that sees that there are three quote marks? The one right after car1 ends the string so the part after it is interpreted as . . . I have no idea. I can't believe there aren't errors reported. Â Should be $howmanycarpics = glob("/garage/uploads/cars/15/thumbs/car1/*.*"); Edited September 28, 2012 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381482 Share on other sites More sharing options...
Pikachu2000 Posted September 28, 2012 Share Posted September 28, 2012 Apparently you are the only one to notice it. I think the path is wrong in addition to that, but I guess the OP hasn't been back. Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381547 Share on other sites More sharing options...
krash11554 Posted September 28, 2012 Author Share Posted September 28, 2012 When i use var_dump(), i get array(0){}. Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381668 Share on other sites More sharing options...
requinix Posted September 28, 2012 Share Posted September 28, 2012 Am I the only one that sees that there are three quote marks? Apparently you are the only one to notice it. *cough* Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381675 Share on other sites More sharing options...
Pikachu2000 Posted September 28, 2012 Share Posted September 28, 2012 Unless your garage/ directory is at the root of the filesystem, you probably need to add the path to the web server's document root, with $_SERVER['DOCUMENT_ROOT'] Quote Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381676 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.