georaldc Posted June 12, 2008 Share Posted June 12, 2008 Ok, I'm pretty new to using PHP and I was wondering if someone could help me here. I've been trying to create a simple gallery and used PHP to access the folders and images and display them on my html page. I do this by creating gallery folders and naming them Gallery 1, Gallery 2 etc, and having the images inside them named 1.jpg, 2.jpg and so on. I grab them by counting the number of folders and files and using this counter as a basis for grabbing the directories names and images. Now I got this to work just fine on my comp when testing it, but once I tried uploading the images and php files to a hosting server, I couldn't count the number of folders/images anymore. The code I used was just some snippet I saw in another forum: $directory = "gallery/"; $handler = opendir($directory); $totalFiles = 0; while ($file = readdir($handler)) { if ($file != '.' && $file != '..') { $totalFiles++; } } $totalFiles doesn't return the number of gallery folder I have anymore once I test it after uploading it to a host Link to comment https://forums.phpfreaks.com/topic/109978-help-with-accessing-filesystem-in-a-hosting-server/ Share on other sites More sharing options...
DarkWater Posted June 12, 2008 Share Posted June 12, 2008 Any errors? What does this return instead of the number of folders/images? Some more info would be nice. =) Link to comment https://forums.phpfreaks.com/topic/109978-help-with-accessing-filesystem-in-a-hosting-server/#findComment-564347 Share on other sites More sharing options...
georaldc Posted June 12, 2008 Author Share Posted June 12, 2008 Well, I have 3 gallery folders in there right now (gallery/Gallery 1, gallery/Gallery 2, gallery/Gallery 3), so its value becomes 3 whenever I test it locally. After uploading, the value just turns to 0. Link to comment https://forums.phpfreaks.com/topic/109978-help-with-accessing-filesystem-in-a-hosting-server/#findComment-564355 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.