# PHP path verification

Does the following path = C:\workqueue\...  ?

\$weborddir="\\c\\$\\workqueue\\".\$ordnum."-".\$pfn.\$invoice;
LVL 1
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
0
Commented:
Depends what you want to do with it:

\$weborddir="C:\workqueue\".\$ordnum."-".\$pfn.\$invoice;
should work fine for screen output, however,

\$weborddir =  quotemeta ( "C:\workqueue\".\$ordnum."-".\$pfn.\$invoice );
may work better if you need to input into a database...

HTH...
0
Author Commented:
this path is placing ouput files in the c:\workqueue folder
0
Commented:
Using the second example should work fine.

If you have Apache installed on your Windows box then you can actually use forward slashes to save any confusion, eg:

\$weborddir="C:/workqueue/".\$ordnum."-".\$pfn.\$invoice;
0
Author Commented:
I get errors when using the 2nd line. I am using IIS so unfortunately I have to keep things confusing... ; )

This is the way the path was written originally for an intranet environment:

\$weborddir="\\\\192.168.1.96\\d\\$\\workqueue\\".\$ordnum."-".\$pfn.\$invoice;

now iam on a webserver wanting to pass the subsequent information to c:\workqueue
0
Commented:
Can't see any reason why the second example won't work.

The original path you gave equates to
\\192.168.1.96\d\$\workqueue\...etc, which points it to the admin share (d\$) or the root of the D: drive.
You don't need to include the \\$ as you gave in your first example.

Try the static path
\$weborddir="C:\\workqueue\\".\$ordnum."-".\$pfn.\$invoice;
if not, try the forward slash version.
0
Author Commented:
i tried that path with slashes both ways and it still does not place the files in the appropriate folder.

if i added my server's ip where 192.168.1.96 is will that essentially be doing the same thing as the path you provided? What does the 4 slashes at the beginning indicate?

\$weborddir="\\\\192.168.1.96\\d\\$\\workqueue\\".\$ordnum."-".\$pfn.\$invoice;

I appreciate you helping me out with this...
0
Commented:
The four slashes indicates a double (escaped) slash path.
Let me explain...

In windows, to indicate a network path, you would use:

\\myserver\sharedpath

as you can see, you need \\ to indicate that it is a network path.

because backslashes are normally used to indicate that the following character is a special character then PHP would normally ignore the backslash (because it thinks that it is indicating something and not actually being used as part of the string)
In order for PHP NOT to interpret a backslash as an indicator that the following character is a special character then you have to escape the backslash itself... eg, \\ = \.

Using four back slashes merely says to PHP that the backslashes should not be interpreted as special characters, which means that \\\\ realy means \\. ...phew

Are you getting any errors?, if so please post them and we will go from there...

0

Experts Exchange Solution brought to you by