WordPress.org

Ready to get started?Download WordPress

Forums

blogs.dir & manual uploading content (2 posts)

  1. Schaeffer
    Member
    Posted 3 years ago #

    I'm working with manually integrating Simpleviewer gallery content in a blog post or page. I can embed content by linking to the gallery folder index page uploaded to the wp-content directory. I can create a subdirectory like gallery, but what is the best practice for creating unique gallery directories for each blog user?

    Can I add directories and content using the blogs.dir path: wp-content/blogs.dir/%BLOG_ID%/files/ ?

  2. David Sader
    Member
    Posted 3 years ago #

    Your code/plugin can be multisite AND single WP compatible with the following I figure.

    $uploads = wp_upload_dir(); //Multisite or not, you get the correct upload folder array

    http://codex.wordpress.org/Function_Reference/wp_upload_dir

    print_r($uploads); //note differences with codex when in a Multisite, blogs.dir shows up?

    Can I add directories and content using the blogs.dir path: wp-content/blogs.dir/%BLOG_ID%/files/ ?

    So the the following should do what you seek:

    $uploads = wp_upload_dir();
    $path = $uploads['basedir'] .  '/gallery/';
    wp_mkdir_p( $path , 0755 );

    http://codex.wordpress.org/Function_Reference/wp_mkdir_p

Topic Closed

This topic has been closed to new replies.

About this Topic