Can someone help me with this,I’m stuck.Dont know why this dont work
$myPath = get_bloginfo('wpurl').'/wp-content/uploads/'; // this is full path
function ReadDirList($d){
$dir = opendir($d);
$fs = "";
while($folder = readdir($dir))
{
//if(is_dir($folder)){
$fs = $fs. '<option>'.$folder.'</option>';
//}
}
closedir($dir);
echo $fs;
}
I call this function <select> <?php ReadDirList($myPath); ?> </select>
tnx in advance.
According to the function reference,
get_bloginfo('wpurl')
is going to be returning a URL. If you want to access the local file system, you need a real filepath, not a URL.Try this for the first line:
WP_CONTENT_DIR
is defined in the config file, and should point to thewp-content
folder of your installation.