The MU forums have moved to WordPress.org

wp_handle_upload (5 posts)

  1. fransimo
    Member
    Posted 17 years ago #

    Hi!,

    I'm trying yapb on WpMu. This plugins uses wp_handle_upload() to know where is located an image.

    The function actually return "/files/2007/1/filename.jpg"
    but ".../blogs.dir/xx/" is missing.

    So... how can I know the blog's upload directory?

    thnaks!

  2. fransimo
    Member
    Posted 17 years ago #

    $uploadedFileInfo = wp_handle_upload($_FILES['yapb_imageupload'], array('action' => $_POST['action']));

    $url = $uploadedFileInfo['url'];
    $siteUrl = get_option('siteurl');
    if (substr($siteUrl, -1) != '/') $siteUrl .= '/';
    $uri = substr($url, strpos($siteUrl, '/', strpos($url, '//')+2));

  3. fransimo
    Member
    Posted 17 years ago #

    I solved partialy with

    if (true) {
    $uri=str_replace("files/",UPLOADS,$uri);
    }

    It works for my instalation, but it's not good idea for a general plugin.

  4. suleiman
    Member
    Posted 17 years ago #

    fransimo, could you tell us what works and what doesn't with this hack?

    I tried integrating yapb on my wpmu install a while back, but gave up when it wasn't working out of hte box.

    thanks.

  5. avsa
    Member
    Posted 16 years ago #

    Fransimo, could you be more specific? which files have you changed in the end? I am also interested in this solution..

About this Topic