SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

PHP directory listing

Many times we have to display the list of files in a directory. We can keep the script in any location and by using the file path we can display the files inside the directory. Read the path and the script will take care to list the files inside that. Here is the code.















// open the current directory by opendir
$handle=opendir(".");

while (($file = readdir($handle))!==false) {
echo "$file <br>";
}

closedir($handle);

Discuss this tutorial at forum


Further readings
Reading from local and remote files by using fopen()
Writing to a file by fwrite() function
unlink:Deleting file by using unlink function
Deleting all files present inside a directory
Downloading files using header control
File upload to server using PHP
File upload using PHP 5 and register_global off
Uploading More than one file to server
Displaying all files and directory of a folder
Getting the Present file name running the PHP script
Getting the last updated time of the file in PHP
Displaying the last modification time of the file
Searching for text within a pair of tags of a html page
Listing All title tags inside a directory














 

Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
PHP Tutorial Index
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
PHP Tutorials
Date & Time
Array
String Functions
Math Functions
Form Handling
File Handling
Comment Posting
Content Management
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.