tags:

views:

19

answers:

3

This is strange I have a constant defined as such:

define("RJ_FILES_PATH", RJ_SITE_DIRECTORY."\assets\files\\");

However when I try to access the constant in code I get this weird result on my localhost..

C:\wamp\www\my.app\assetsiles\2688

The \f is replaced by a square indicating it as an unrecognised character. Whats happening because of this I am unable to save files to the folder the constant is supposed to point to.

+3  A: 

You need to escape the backslashes before the a and the f:

define("RJ_FILES_PATH", RJ_SITE_DIRECTORY."\\assets\\files\\");

Otherwise they're interpreted as escape codes, since they're within a string. (Just like \n is a newline, et cetera.)

Amber
+1  A: 
amphetamachine
This is referring to the actual path - I tried using relative paths but it wouldn't work as I expected
Ali
A: 

You should escape the backlash by double it: \ In my opinion, you always should use '/', because it work fine in windows and linux. In php, there's a constant DIRECTORY_SEPARATOR but it's uneccesary because '/' work fine.

coolkid