php - Check If Folder Exists Is Not Working -
i'm trying function recognize if folder exists on server, it's not working. i've tried is_dir function no luck.
this script trying utilized in wordpress plugin, it's using php-based function if file/folder exists. idea why it's not recognizing /docs folder exists? i've verified $filename pulling correct file path on server.
function docs_settings_page() { $filename = get_stylesheet_directory_uri()."/docs/"; if(file_exists($filename)) { echo "the folder exists!"; } else { echo "sorry - file not exist."; } } function docs_create_menu() { // stuff here } add_action('admin_menu', 'docs_create_menu');
the get_stylesheet_directory_uri()
function returns uri of document.
in case need absolute path, not uri.
clarification:
uri: thing type browser.
absolute path: path root directory of webspace / server.
so 'docs' folder inside theme's directory do
$path = get_template_directory()."/docs/"
i hope helped, sebastian
Comments
Post a Comment