WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

All, I'm using the Uploadify plugin to upload some images. I've included the uploadify folder in my themes folder. However, when I try and call uploadify.php I get the following error:

Call to undefined function wp_upload_dir()

My code looks like this:

global $cssPath, $jsPath, $themePath, $theLayout;
$upload_dir = wp_upload_dir();
echo $upload_dir['path'];

Any idea how I can use this properly? Thanks for any suggestions in advance!

share|improve this question

It seems that you're either calling wp_upload_dir too early, when it has not yet been included in the scope (which is nearly impossible), or calling it without WordPress being even loaded (highly probable).

If you're using some sort of iframe to provide uploadify.php directly then WordPress will not be available for it. Include wp-load.php to load up a WordPress environment before actually trying to use wp_upload_dir. Alternatively, and much better, include uploadify.php into the WordPress scope instead in your template or hook, whatever you are using to position to the upload form correctly.

Better yet, just use the code inside from the basic demo inside your template file directly without the need for a separate uploadify.php.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.