Possible Duplicate:
Getting the names of all files in a directory with PHP
I am trying to build a thing where i can scan all the .txt files in a directory then explode them into an array, the seperation would be a "|", then insert them into a sql DB
Possible Duplicate:
Getting the names of all files in a directory with PHP
I am trying to build a thing where i can scan all the .txt files in a directory then explode them into an array, the seperation would be a "|", then insert them into a sql DB
Please try this with your values
$files_names="";
//path to directory to scan
$directory = "path_to_directory";
//get all text files with a .txt extension.
$files = glob($directory . "*.txt");
//print each file name
foreach($files as $files_names)
{
$files_names."|".=$files_names;
}
you can use above answer, but simplified
$file_names = implode('|', glob('*.txt'));