dagon;10914504 wrote:take a look at glob, i think it will be much easier solution
Mmm....I followed your advice and things got even stranger.
I created a script and ran it from the command line:
<?php
$internalpath = "/home/albert/work/";
$fileList = glob($internalpath . "{*.pdf}", GLOB_BRACE);
foreach($fileList as $filename) {
echo $filename."\n";
}
?>
This worked like a charm! As I excepted, it retrieved the names of five PDF files located in "/home/albert/work/";
When I use the same approach in a form "index.php" ...
<form action="search.php" method="post">
directory path to search: <input type="text" name="dir" />
<input type="submit" />
</form>
...that calls "search.php"
<?php
$internalpath = $_POST['dir'];
$fileList = glob($internalpath . "{*.pdf}", GLOB_BRACE);
foreach($fileList as $filename) {
echo $filename."<br>";}
?>
Nothing happens! This is so confusing!! What can I be doing wrong here?? Any idea??
Al.