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 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. 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 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 My guess is that the path is wrong. What do you get from var_dump( glob("/garage/uploads/cars/15/thumbs/car1"/*.*") ); 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 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/*.*"); 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. 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){}. 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* 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'] Link to comment https://forums.phpfreaks.com/topic/268867-glob-function/#findComment-1381676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.