which function used to get the file name in php?
Answers were Sorted based on User's Feedback
Answer / simran
The file name on the browser system
$file_name=$_FILES[$fieldName]['name'];
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / lakshmi
<?php
$path = "/home/httpd/html/index.php";
$file = basename($path);
$file = basename($path, ".php");
?>
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / naga
$parts = Explode('/', $_SERVER["SCRIPT_NAME"]);
$currentFile = $parts[count($parts) - 1];
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / nilsoft
Method 1.
$file = trim($_SERVER["SCRIPT_NAME"],'/');
Method 2.
$file =
substr($_SERVER["SCRIPT_NAME"],1,strlen($_SERVER["SCRIPT_NAME"])-1);
Method 3.
$file = str_replace('/','',$_SERVER["SCRIPT_NAME"]);
Method 4.
$file = basename($_SERVER["SCRIPT_NAME"]);
Is This Answer Correct ? | 0 Yes | 0 No |
How can we convert the time zones using PHP?
How to remove an empty directory?
How will you calculate days between two dates in PHP?
what is the current salary package in India for a PHP & MySQL programmer who has 3 years experience
127 Answers ABC, BLG Logistics, Google, HCL, IBM, Infosys, People Group, PHP, Torque Infotech, V Angelz Technologies, Yahoo,
What is the use of trim function in php?
What does the array operator '===' means?
What is php oop?
How to find the index of an element in an array php?
How do you pass a variable by value in php?
What is the difference between query and inquiry?
Explain me what is the goto statement useful for?
What are some new features introduced in php7?