473,382 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

file path

160 100+
hi to all

i have a php file within i redirect a page. but when i include this file in another directory then i also have to change path of redirect file.
like this

Expand|Select|Wrap|Line Numbers
  1. header("Location:../ques2.php");
  2.  
or
Expand|Select|Wrap|Line Numbers
  1. header("Location:../../ques2.php");
  2.  
etc

i want that i just include a file in any directory and path of a redirect file change accordingly.

i think i am not clear in my question. what i need to explain more?
Mar 31 '09 #1
5 2494
Dormilich
8,658 Expert Mod 8TB
consider using an absolute path
Expand|Select|Wrap|Line Numbers
  1. define("MY_FILE_PATH", "/root_dir/path/to/file/");
  2. header("Location: " . MY_FILE_PATH . "ques2.php");
Mar 31 '09 #2
waqasahmed996
160 100+
Expand|Select|Wrap|Line Numbers
  1. define("MY_FILE_PATH", "/root_dir/path/to/file/");
  2.  
is it possible that it take path "/root_dir/path/to/file/" dynamically
Apr 1 '09 #3
Dormilich
8,658 Expert Mod 8TB
@waqasahmed996
what do you mean with "dynamically"?
Apr 1 '09 #4
waqasahmed996
160 100+
means my file may be on local server and path may be like this

http://localhost/hms/file.php

or it may be on real server

http://www.example.com/abc/file.php

but i do not have to change path in coding
Apr 1 '09 #5
Dormilich
8,658 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. // e.g. located in a configuration file
  2. define("BASE_DIR", realpath(dirname(__FILE__)) . '/'); // currently the configuration folder
make sure to traverse back/forth from the config file to your destination directory
Apr 1 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: chris | last post by:
I'm writing a small app to help me learn more about cryptography. All it does is encrypt all of the files in directory A, and put the encrypted versions of the files in directory B. It then...
11
by: BoonHead, The Lost Philosopher | last post by:
I think the .NET framework is great! It's nice, clean and logical; in contradiction to the old Microsoft. It only saddens me that the new Microsoft still doesn't under stand there own...
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
6
by: Alex Chan | last post by:
Hi Group, I encountered something strange with File.Exists(string path). This function is simply to check whether a file exists in certain path. However, if the path starts with "file:\" in the...
6
by: I am Sam | last post by:
I keep getting this error and I don't know why: The path is too long after being fully qualified. Make sure path is less than 260 characters. Description: An unhandled exception occurred...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
4
by: tasahmed | last post by:
Hello Friends, I wrote a function which scans the current working directory and lists out details such as directory/file owner, permission etc. The output of this script can be viewing in the...
5
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } ...
2
by: JohnLorac | last post by:
Hello, I'm trying to load and write file on local disc drive using signed javascript file. But I have experienced problem running this url: ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.