Jump to content

drop down box out of folders


tannx

Recommended Posts

Right now the directory where to look files is hardcoded

$handler = opendir("/var/www/.");

 

I need to implement that I can select folders.

Folders and files are added every month.

First I need to make selection out of YYYYMM and then select subfolder AO to get files

Folder structure:

/YYYYMM/AH/files

/YYYYMM/RG/files

etc

 

<?php include("/etc/password_protect.php"); ?>
<?php
    $file = $_GET['file'];
    if (isset($file))
    {
       echo "decompress " . $file . "<br>";
	system("gzip -d < $file >/home/output/$file");
       exit;
    }
    $handler = opendir("/var/www/.");
    echo "Select file: " . "<br>";
    echo '<FORM action="" method="get">';
    $found = FALSE; 
    while ($file = readdir($handler))
    {
        if (preg_match ("/.gz$/i", $file))
        {
            echo '<input type="radio" name="file" value=' . $file . '> ' . $file . '<br>';
            $found = true;
        }
    }
    closedir($handler);
    if ($found == FALSE)
        echo "not found .gz <br>";

Link to comment
https://forums.phpfreaks.com/topic/132404-drop-down-box-out-of-folders/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.