I have tried this but as of yet am unfamiiar with php code. Pretty sure the following code is the part which scans the directories, and I have tried fidling with it without any success. Can anyone point me in the right direction please?
/[FONT="Courier New"]/ Get this folder and files name.
$this_script = basename(FILE);
$this_folder = str_replace('/'.$this_script, '', $_SERVER['SCRIPT_NAME']);
// Declare vars used beyond this point.
$file_list = array();
$folder_list = array();
$total_size = 0;
// Open the current directory...
if ($handle = opendir('.'))
{
// ...start scanning through it.
while (false !== ($file = readdir($handle)))
{
// Make sure we don't list this folder, file or their links.
if ($file != "." && $file != ".." && $file != $this_script)
{
// Get file info.
$stat = stat($file); // ... slow, but faster than using filemtime() & filesize() instead.
$info = pathinfo($file);
// Organize file info.
$item['name'] = $info['filename'];
$item['lname'] = strtolower($info['filename']);
$item['ext'] = $info['extension'];
if($info['extension'] == '') $item['ext'] = '.';
$item['bytes'] = $stat['size'];
$item['size'] = bytes_to_string($stat['size'], 2);
$item['mtime'] = $stat['mtime'];
// Build links. Add interactivity. Be cool.
if(in_array($item['ext'], array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) // thickbox for images
{
$item['link'] = '<a class="thickbox" href="'.$item['name'].'.'.$item['ext'].'">'.$item['name'].'.'.$item['ext'].'</a>';
}
elseif(in_array($item['ext'], array('mov', 'mpg', 'mpeg'))) // thickbox for quicktime
{
$item['link'] = '<a class="thickbox" href="'.$this_script.'?display=quicktime&file='.$item['name'].'.'.$item
['ext'].'&TB_iframe=true&width='.$vWidth.'&height='.$vHeight.'">'.$item['name'].'.'.$item['ext'].'</a>';
}
elseif($item['ext'] == 'flv') // thickbox for flv's'
{
$item['link'] = '<a class="thickbox" href="'.$this_script.'?display=flv&file='.$item['name'].'.'.$item
['ext'].'&TB_iframe=true&width='.$vWidth.'&height='.$vHeight.'">'.$item['name'].'.'.$item['ext'].'</a>';
}
elseif($item['ext'] == 'mp3') // thickbox for mp3's'
{
$item['link'] = '<a class="thickbox" href="'.$this_script.'?display=mp3&file='.$item['name'].'.'.$item
['ext'].'&TB_iframe=true&width=200&height=20">'.$item['name'].'.'.$item['ext'].'</a>';
}
else // standard link
{
$item['link'] = '<a href="'.$item['name'].'.'.$item['ext'].'">'.$item['name'].'.'.$item['ext'].'</a>';
}
// Add files to the file list...
if($info['extension'] != '')
{
array_push($file_list, $item);
}
// ...and folders to the folder list.
else
{
array_push($folder_list, $item);
}
// Clear stat() cache to free up memory (not really needed).
clearstatcache();
// Add this items file size to this folders total size
$total_size += $item['bytes'];
}
}
// Close the directory when finished.
closedir($handle);
}
// Sort folder list.
if($folder_list)
$folder_list = php_multisort($folder_list, $sort);
// Sort file list.
if($file_list)
$file_list = php_multisort($file_list, $sort);
// Calculate the total folder size
if($file_list && $folder_list)
$total_size = bytes_to_string($total_size, 2)[/SIZE][/FONT];[/COLOR]
Thanks :-D