0
X
Add Snippet To Project
New Project
Add To Existing Project
<?php
// Get the upload directory path
$upload_dir = wp_upload_dir();
$directory_path = $upload_dir['basedir'];
// Get the list of directories
$directories = glob($directory_path . '/*', GLOB_ONLYDIR);
// Output the list of directories
echo 'Directories:';
foreach ($directories as $directory) {
echo '<li>' . basename($directory) . '</li>';
}
// Check if the form is submitted
if (isset($_POST['submit'])) {
// Rest of the code...
// ...
}
?>
Explanation:
Make sure to place this code at the top of your wp-plugin.php file, before the existing code snippet. This will first list the directories and then execute the remaining code when the form is submitted.