HektoR Posted January 16, 2009 Share Posted January 16, 2009 hi all. i have something like this : (see picture) http://img73.imageshack.us/my.php?image=55284945gp5.jpg how can i get directories and files with php ? Thank you. Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/ Share on other sites More sharing options...
chronister Posted January 16, 2009 Share Posted January 16, 2009 Check out the following links.. http://us2.php.net/manual/en/ref.dir.php http://us2.php.net/manual/en/function.glob.php http://us2.php.net/manual/en/ref.filesystem.php Read up on the different functions that are used for files and directories. Nate Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738221 Share on other sites More sharing options...
HektoR Posted January 16, 2009 Author Share Posted January 16, 2009 thank you very much for links and reply. i know this methods but it does not works. this method can be use when directory path is /root/www for example. but in this case my path is http://localhost/ Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738223 Share on other sites More sharing options...
chronister Posted January 16, 2009 Share Posted January 16, 2009 No, the URL is http://localhost.... but in the background your directory path is either /some/path/to/file.php or c:\some\path\to\file.php Either way, the directory functions that are in the links I gave you will do what you want, you just need to learn how to use them.... For example copy, paste and run this script in a page on your server... <?php echo '<pre>'; print_r(glob('*')); echo '</pre>'; ?> It should give an array of all the directories and files in the directory this script is called from. Nate Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738226 Share on other sites More sharing options...
HektoR Posted January 16, 2009 Author Share Posted January 16, 2009 No, the URL is http://localhost.... but in the background your directory path is either /some/path/to/file.php or c:\some\path\to\file.php you right thank you Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738227 Share on other sites More sharing options...
HektoR Posted January 16, 2009 Author Share Posted January 16, 2009 and also i want to block view this folder(2007 and 2008 it is music folders) but when i give link to player (ex:http://myglobalip/2007/linkin park.mp3) it must play. is it possible? Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738233 Share on other sites More sharing options...
chronister Posted January 16, 2009 Share Posted January 16, 2009 Are you talking about denying directory browsing? Add this to your .htaccess file. Options -Indexes When you add that to the .htaccess file (if it don't exist, then create it) you will get an error stating directory browsing is not allowed. Nate Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738322 Share on other sites More sharing options...
HektoR Posted January 16, 2009 Author Share Posted January 16, 2009 it works ! thank you very much ! SOLVED ! Link to comment https://forums.phpfreaks.com/topic/141044-solved-get-contents/#findComment-738374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.