Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to make a script that uploads a file to a specific folder in the wordpress installation.

Basically I want to upload to /uploads. However, in order to do this I need to know the server path for the WordPress installation.

How can I get this?

share|improve this question
    
Related: wordpress.stackexchange.com/questions/12339/… –  hakre Jul 8 '11 at 15:19
add comment

2 Answers

up vote 4 down vote accepted

Use wp_upload_dir() for path to uploads, and use get_bloginfo() to get paths to the WP location

share|improve this answer
    
aha! brilliant, thank you. –  Thomas Clayson Jul 8 '11 at 15:06
add comment

You can retrieve the path where Wordpress has been installed to from the ABSPATH constant.

It should be available in your plugin/theme code, it is defined at the very start of wp-load.php.

See also: Using the ABSPATH constant - What files need to be loaded before use?

share|improve this answer
add comment

Your Answer

 
discard

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.