Filename For Linux?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Zorth
Forum Commoner
Posts: 76
Joined: Fri Feb 20, 2004 8:00 pm

Filename For Linux?

Post by Zorth »

Hey all,

This is a simple question. I'm trying to get this PHP script to open a file on a Linux system, and the file is not in the htdocs directory, rather it's in the main hard drive area. If the file was somewhere like: "C:\folder1\text.txt", how would the syntax go for the file? It doesn't seem to work the same way as it did in Windows.

Thanks.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

/somewhere/folder1/text.txt
Zorth
Forum Commoner
Posts: 76
Joined: Fri Feb 20, 2004 8:00 pm

Post by Zorth »

Hey, thanks for the reply. I noticed you put /somewhere, what would somewhere be? The drive it's in? Also, wouldn't /somewhere tell it to look for that folder in the htdocs directory?
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

In linux / is root of the file system node, so all other directories are in this one. /home/blah will start from the root of the file system and not the directory you are in. The usual rules then apply where ../ is one dir back up the tree and no / is the current directory.
Post Reply