php path

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
ilovedoingwebsites
Forum Newbie
Posts: 5
Joined: Fri May 08, 2009 5:41 pm

php path

Post by ilovedoingwebsites »

Hello everybody,

I am sorry but I am so new to this but I have a question.

How do I find the path to a particular folder?

I have a script that needs the path to the folder, it says in the instructions:

1. Edit includes.php and add the following lines:

Code: Select all

 
$uploadpath = "/var/www/vhosts/sitename.com/httpdocs/uploads/";
 
You will need to change $uploadpath to a directory that you create for file uploads. On Unix CHMOD this directory to 777. On Windows, the path may look like $uploadpath = "C:/Inetpub/wwwroot/sitename.com/uploads/"

so I don't know the path to the uploads folder.

THank you very much!!! :D
Last edited by Benjamin on Fri May 08, 2009 5:48 pm, edited 1 time in total.
Reason: Added [code=php] tags. Removed bold text.
mdk999
Forum Newbie
Posts: 22
Joined: Fri May 08, 2009 3:21 pm

Re: php path

Post by mdk999 »

Depending on your setup .. you can add ..

Code: Select all

 
echo dirname(__FILE__);
 
in a php file in the root of your website and it should tell you the path to that file. You can then make a folder called 'uploads' in the webroot and then you just append that to the path..
ilovedoingwebsites
Forum Newbie
Posts: 5
Joined: Fri May 08, 2009 5:41 pm

Re: php path

Post by ilovedoingwebsites »

this is my code and I have a white page with nothing

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
<?php
# echo dirname(__FILE__);
?>
</body>
</html>
Last edited by Benjamin on Fri May 08, 2009 6:08 pm, edited 1 time in total.
Reason: Changed code type from text to html.
ilovedoingwebsites
Forum Newbie
Posts: 5
Joined: Fri May 08, 2009 5:41 pm

Re: php path

Post by ilovedoingwebsites »

Sorry I make it work, but the path doesn't give me the drive like "d:// etc etc etc"

I have this only:

/home/content/l/o/c/locolacayote12/html/adobe
mdk999
Forum Newbie
Posts: 22
Joined: Fri May 08, 2009 3:21 pm

Re: php path

Post by mdk999 »

That is because you are on a *nix system and there is no C:\ or D:\ glad you got it working ..
ilovedoingwebsites
Forum Newbie
Posts: 5
Joined: Fri May 08, 2009 5:41 pm

Re: php path

Post by ilovedoingwebsites »

thank you and I am sorry for such a simple question but I am on my diapers here

Mauricio
mdk999
Forum Newbie
Posts: 22
Joined: Fri May 08, 2009 3:21 pm

Re: php path

Post by mdk999 »

That's what the forums are for .. so don't feel bad .. just ask away ;)
Post Reply