GetSimple Support Forum

Full Version: Uploading files fails
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Following line in "admin/upload-ajax.php" (GS2.01) calculates wrong path when used with Apache alias:

Code:
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';

EDIT:

Dirty/quick fix is to just replace it with following:

Code:
$targetPath = get_root_path() . 'data/uploads/';
Is there any reason why this shouldnt be the default way to handle this? I dont see any reason...
john5 Wrote:Following line in "admin/upload-ajax.php" (GS2.01) calculates wrong path when used with Apache alias:

Code:
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';

EDIT:

Dirty/quick fix is to just replace it with following:

Code:
$targetPath = get_root_path() . 'data/uploads/';
The reason is that $_SERVER['DOCUMENT_ROOT'] does not give the path to executing (.php) files location when used with Apache alias (at least on my local WAMP and on my Linux host).

dirname(__FILE__) (as in get_root_path()) should be used instead.

EDIT: More about unexpected DOCUMENT_ROOT values: https://issues.apache.org/bugzilla/show_...i?id=26052


Wishes,
I just looked, and that line now reads:

Code:
$targetPath = GSDATAUPLOADPATH;

and in common.php, GSDATAUPLOADPATH is set to this:

Code:
define('GSDATAUPLOADPATH', get_root_path(). 'data/uploads/');

So i think we are fine with 2.02 (very stable at this point - we are just working out all the remaining small bugs before we release it)
Pages: 1 2 3