Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

PHP path verification

Posted on 2007-03-28
Last Modified: 2013-12-13
Does the following path = C:\workqueue\...  ?

Question by:guy4graphics
  • 4
  • 3
LVL 48

Expert Comment

ID: 18814212
Could you please add some more words to your question. I can't understand what you want or asking.

Expert Comment

ID: 18815104
Depends what you want to do with it:

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...


Author Comment

ID: 18817033
this path is placing ouput files in the c:\workqueue folder
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Expert Comment

ID: 18818086
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:


Author Comment

ID: 18818171
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:


now iam on a webserver wanting to pass the subsequent information to c:\workqueue

Expert Comment

ID: 18818290
Can't see any reason why the second example won't work.

The original path you gave equates to
\\\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
if not, try the forward slash version.

Author Comment

ID: 18818732
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 is will that essentially be doing the same thing as the path you provided? What does the 4 slashes at the beginning indicate?


I appreciate you helping me out with this...

Accepted Solution

Arrivist earned 500 total points
ID: 18820081
The four slashes indicates a double (escaped) slash path.
Let me explain...

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


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

Anyway, back to your problem...
Are you getting any errors?, if so please post them and we will go from there...


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question