I did this recently.........
I have a file called files.txt which contains the following:
7ad6ace532b83674d38629638e86cfe6|avatar2.jpg|278648|192.168.254.1
ba1d118ec9dbd0b61872883ac1db1133|batracer.jpg|265095|192.168.254.2
85f377352b62e22edab31552a6a7d30c|icute.jpg|133255|192.168.254.3
49f0a58515b57f283932f2aff216a76f|plugb.jpg|339117|192.168.254.4
// initialise array
$order = array();
//read file contents into an array
//each line will be one element
$checkfiles=file("./files.txt");
//cycle through each line of the array and split it into sections using explode
// | is the character I used for separation of elements.
foreach($checkfiles as $line)
{
// add each element to the array
$order[] = explode('|', $line);
}
This will create a two-dimensional array which looks like the following:
Array
(
[0] => Array
(
[0] => 7ad6ace532b83674d38629638e86cfe6
[1] => avatar2.jpg
[2] => 278648
[3] => 192.168.254.1
)
[1] => Array
(
[0] => ba1d118ec9dbd0b61872883ac1db1133
[1] => batracer.jpg
[2] => 265095
[3] => 192.168.254.2
)
[2] => Array
(
[0] => 85f377352b62e22edab31552a6a7d30c
[1] => icute.jpg
[2] => 133255
[3] => 192.168.254.3
)
[3] => Array
(
[0] => 49f0a58515b57f283932f2aff216a76f
[1] => plugb.jpg
[2] => 339117
[3] => 192.168.254.4
)
)
If I wanted to print out the a list of all the file-names I would do the following:
for ($i = 0; $i < count($order); $i++) {
echo $subarray[$i][1]."<br>";
}
This would produce:
avatar2.jpg
batracer.jpg
icute.jpg
plugb.jpg
Hope that helps