WordPress upload file - get path to WordPress installation
-
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?
-
Answer:
Use http://codex.wordpress.org/Function_Reference/wp_upload_dir for path to uploads, and use http://codex.wordpress.org/Function_Reference/get_bloginfo to get paths to the WP location
Thomas Clayson at WordPress Visit the source
Other answers
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 http://core.trac.wordpress.org/browser/tags/3.1/wp-load.php. See also: http://wordpress.stackexchange.com/q/12047/178
hakre
Related Q & A:
- How to upload file to google cloud storage using Java?Best solution by Stack Overflow
- How I can validate input on form before upload file?Best solution by stackoverflow.com
- How to upload file using ajax php?Best solution by Stack Overflow
- How to upload file in AngularJS?Best solution by Stack Overflow
- How to upload file to a server from Salesforce?Best solution by help.salesforce.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.