AjaxUploader (PHP) and symlinks

  •  09-22-2010, 7:47 AM

    AjaxUploader (PHP) and symlinks

    Goodday Devs of the AJAXuploader,
     
    Today we decided to redo some structures on our webserver and in doing so decided that we'd use a symlink to our webroot and such.
     
    The result; 
    Error: CuteWebUI_AjaxUploader_Initialize is not defined
    Source File: BLOCKED SCRIPTalert('TODO: FIXME')
    Line: 0
     
    Now, don't worry! I fixed it!
     
    The problem is your GetWebPath function (line 223 in include_phpuploader.php).
    The function is pretty nice and thought through, but
     
    __FILE__ (which is the param used for the function) is a REALPATH (so /var/foo/real/path/).
    $_SERVER['SCRIPT_FILENAME'] (which is what is used to refactor the path) is NOT a realpath (so /var/foo/symlink/path/).
     
    The result is a missmatch!
     
    The fix is pretty simple, though I'm not 100% sure if it's flawless,. but it works for me;
     
           $ppath= realpath($_SERVER['SCRIPT_FILENAME']);
           $vpath= realpath($_SERVER['SCRIPT_NAME']);
     
    I wrapped realpath functions around these so that all paths are now the same (realpaths, no symlinks).
     
     
    Hope this is something you can fix for other ppl too,
     
    keep up the good work :)
View Complete Thread