GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

  •  08-26-2013, 5:21 AM

    GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

    Im having some issues with GetWebPath(). Seems My host recently migrated my hosting account to a new/upgraded server. Now my uploader is not working. The host had little to no help on this issue. So I made some mods to the function to make it work for me. Maybe you have a better more full proof solution. Seems I have an alias in use sometimes. Actual real root path is /home3/user/. Alias is /home/user/.

    Here are some variable dumps: 

    $pfile = /home3/user/public_html/www2/wp-content/mu-plugins/track-management/trackuploader/phpuploader/include_phpuploader.php
    $_SERVER['SCRIPT_FILENAME'] = /home/user/public_html/www2/wp-admin/admin.php
    $_SERVER['ORIG_SCRIPT_FILENAME'] = NULL 
    $scriptfile = /home/user/public_html/www2/wp-admin/admin.php
    __FILE__ = /home3/user/public_html/www2/wp-content/mu-plugins/track-management/trackuploader/phpuploader/include_phpuploader.php
    $vpath = /wp-admin/admin.php
    the output url of getwebpath is http://domain.com/wp-admin/3/user/public_html/wp-content/mu-plugins/track-management/trackuploader/phpuploader/ajaxuploaderresource.php?type=file&file=continuous.gif 
    realpath($_SERVER['SCRIPT_FILENAME']) = /home3/user/public_html/www2/wp-admin/admin.php 
    after wrapping the realpath($_SERVER['SCRIPT_FILENAME']) 
    my output changed to http://domain.com/wpcontent/mu-plugins/track-management/trackuploader/phpuploader/ajaxuploaderresource.php?type=file&file=continuous.gif (removnig the hyphen from wp-content, so i hacked it up to make the output what i needed, by using str_replace).
    Hopefully you can improve the function to be a bit more full proof. I can test things if you need me to I have a deveopment server in the same environment.

    Thanks,

    Jesse 

View Complete Thread