473,404 Members | 2,170 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,404 software developers and data experts.

can i use php to know file name..?

8
Hello,

i want to ask can i use php to get a file name,

for example, i uploaded two file called - abc.php, dfg.php on my server,

once i go to the page - abc.php , something like a window or other will blow out and say : you are on abc.php page.

then when i go to the page - dfg.php , as same, something like a window or other will blow out and say : you are on dfg.php page.

so is there any php code can do this?

Thanks
Aug 16 '10 #1

✓ answered by zorgi


9 1548
ggcdc
8
it's quite hard to read, please show me the one amoung those code...
Aug 16 '10 #3
zorgi
431 Expert 256MB
@ggcdc
Knowing how to read manual is essential. Without it you are not getting very far. Anyhow here is the clue. Just do this:

Expand|Select|Wrap|Line Numbers
  1. echo $_SERVER['PHP_SELF'];
  2.  
Aug 16 '10 #4
ggcdc
8
with $_SERVER['PHP_SELF'] , will the result show only abc.php or /xxxx/adc.php or others?
Aug 16 '10 #5
zorgi
431 Expert 256MB
So the clue didn't help!?

Expand|Select|Wrap|Line Numbers
  1. echo basename($_SERVER['PHP_SELF']);
  2.  
Aug 16 '10 #6
ggcdc
8
err.. just curious, because i got the result like { /abc.php}

anyway, its work, thanks for your help.
Aug 16 '10 #7
ggcdc
8
wrong board, post edited
Aug 16 '10 #8
zorgi
431 Expert 256MB
You should ask that question in JavaScript / Ajax / DHTML
Aug 16 '10 #9
johny10151981
1,059 1GB
hey,
Zorgi has answered your question. But even though you can try this to get your php file name :)

Expand|Select|Wrap|Line Numbers
  1. echo __FILE__;
  2.  
Aug 17 '10 #10

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

Similar topics

6
by: vishal | last post by:
hi how can i get the file name from which the current executing file is called. i m making a scrript which will be called from many other scripts. this script performs some calculation and then...
8
by: Fu Bo Xia | last post by:
the java.lang.Object.forName method takes a java class name and returns a Class object associated with that class. eg. Class myClass = Object.forName("java.lang.String"); by if i only know the...
4
by: Andreas Neudecker | last post by:
Hi. I know you can read the filename of a program as sys.argv. But what about modules? Is there a similar way to find out the file name of a module (called by some other module or program) from...
1
by: Marek Prerovsky | last post by:
Hello, I implemented some Python functions in my C/C++ code. I need to know the Python source file name and line number of just executed Python command which calls my function. How can I get...
21
by: ryanmhuc | last post by:
I know the subject might be confusing. I am no beginner with javascript but I haven't been able to figure out how to get the javascript file name from code inside the file. So you have an HTML...
17
by: Joe Laughlin | last post by:
I've not used C much before, so I don't know how robust or good this code is. I'd appreciate any feedback or criticisms anyone has! Thanks, Joe #include <stdio.h> #include <string.h>
1
by: MarkWH | last post by:
I am writing a simple reverse proxy using .Net. The basic design is to capture all traffic (from all URL's) in an HttpHandler and the respond accordingly. The problem is that I when a URL is...
5
by: tcwarrior | last post by:
Hi all. I am trying to write a little program where I extract some data out of a game in real time. The game writes some info to a log file, and I can access this in real time. The problem is that...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
9
by: Bill David | last post by:
I know it's very strange to do that since we have the file name when we call: int open(const char *pathname, int oflag,...); And we can store the file name for later usage. But I just wonder if...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.