Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uploading files fails
#51
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/';
Reply
#52
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/';
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#53
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,
Reply
#54
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)
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply




Users browsing this thread: 1 Guest(s)