The following function can be used to get the absolute path to the WordPress uploads directory:

It will return a path to where the WordPress /uploads/ directory is, whether it’s in the default location or whether an UPLOADS constant has been defined to specify an alternate location. The path it returns will look something like:

/path/to/wordpress/wp-content/uploads/

Leave a reply

Your email address will not be published. Required fields are marked *