Jump to content

Getting Files.....


Jamesking56

Recommended Posts

you can use this function:

// show inside of a directoryfunction intofolder($directory) {	$show_file = '';	if ($handle = opendir($directory)) {		$show_file = 'Directory handle: $handle<br />'.					 'File:<br />';		while (false !== ($file = readdir($handle))) {			$show_file .= $file .'<br />';		}		closedir($handle);	}	return $show_file;}

Link to comment
Share on other sites

When I use glob(); it comes up as just"Array"
You're not using glob correctly.
$files = glob("/path/to/dir/*.*");foreach($files as $file){  echo $file . "<br>";}foreach ($files as $file){  echo "<a href=\"{$file}\">{$file}</a><br>";}

Link to comment
Share on other sites

Glob takes a single argument which specifies the filename and path, and a second optional one specifying what sort of files to return. It accepts the wildcard character *, and a limited form of regular expressions.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...