tannx Posted November 12, 2008 Share Posted November 12, 2008 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 More sharing options...
JasonLewis Posted November 12, 2008 Share Posted November 12, 2008 You can use glob to create an array of folders/files. Although if you want it to scan subfolders you would need to make a recursive function. Link to comment https://forums.phpfreaks.com/topic/132404-drop-down-box-out-of-folders/#findComment-688371 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.