This PHP Code snippet lists all files in a folder and hyperlinks them accordingly. Very clean, easy to use function. Just cut and paste.
<?php
/*
This is a simple function to list all files in a specific folder on your web server.
Function require path to the folder to be passed on to it.
It then echoes the Hyperlinked list of files.
*/
function listFilesInDirectory($folder)
{
// Function gets name of folder
if(is_dir($folder))
{ // Works only if the folder is found
if($handle = opendir($folder))
{ // Now it has successfully opened the folder to get its content.
while(($file = readdir($handle)) !== false)
{ // Now we look through all file and folder names
if($file != "." && $file != ".." && $file != "Thumbs.db")
{ // Here we ignore some file names like [.] [..] and Thumbs.db files/folders
// Now we print the hyperlinked list of files/folders
// <a> tag is for links
// <br> tag is for line feeds.
echo '<a target="_blank" href="'.$folder.$file.'">'.$file.'</a><br>'."\n";
}
}
closedir($handle); // This does some housekeeping
}
}
} // End of List Files In directory function
// Let Us call the function and see how it goes!
listFilesInDirectory("path/to/folder/inside/script");
?>
I want folder to gallery PHP Script. I will have all images in one folder. And PHP Script should show those images on a web page. It should page it will 25 images per page.
Price $25 Order Now
I need PHP folder listing script which shows list of sub-folders and clicking on sub-folder should show sub-folder in it.
Price $15 Order Now
I want PHP code to show folder permissions.
Price $5 Order Now
I want PHP Script to rename all files in a folder by appending certain text string to file names.
Price $5 Order Now
It is a very nice PHP time ago function. You gave pass any date to it and it will tell...
PHP Script to scan a text and extract all email ids contained in the text. It outputs email addresses as...
This is a simple PHP function to parse text provided and automatically hyperlink the links in the text.
100% Free PHP folder to gallery script. Just give the name of folder and it will generate gallery of all...
This PHP function extracts all numbers from a String and prints them as a comma separated list of numbers. Ready...
This PHP Code snippet lists all files in a folder and hyperlinks them accordingly. Very clean, easy to use function....
PHP Script to create thumbnail of any image (.jpg, .png and .gif). This create thumbnail function is ready to use....
A very simple php snippet to check if an email id is valid or not. If the email address is...