which function used to get the file name in php?

Answers were Sorted based on User's Feedback



which function used to get the file name in php?..

Answer / simran

The file name on the browser system
$file_name=$_FILES[$fieldName]['name'];

Is This Answer Correct ?    8 Yes 0 No

which function used to get the file name in php?..

Answer / lakshmi

<?php
$path = "/home/httpd/html/index.php";
$file = basename($path);
$file = basename($path, ".php");
?>

Is This Answer Correct ?    4 Yes 0 No

which function used to get the file name in php?..

Answer / naga

$parts = Explode('/', $_SERVER["SCRIPT_NAME"]);
$currentFile = $parts[count($parts) - 1];

Is This Answer Correct ?    1 Yes 1 No

which function used to get the file name in php?..

Answer / jaimin desai

$file_name=$_FILES[$ControlName]['name'];

Is This Answer Correct ?    0 Yes 0 No

which function used to get the file name in php?..

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

Post New Answer

More PHP Interview Questions

How do you end a function in python?

0 Answers  


Which is faster for or foreach php?

0 Answers  


write a note on Testing the web site

0 Answers  


What are the special characters you need to escape in double-quoted stings?

0 Answers  


What is a http session?

0 Answers  


What is difference Between PHP 5 and 7?

0 Answers  


How would you determine the size of a file in php?

0 Answers  


What is the integer?

0 Answers  


What is trim codeigniter?

0 Answers  


How can we know the number of days between two given dates using PHP?

8 Answers   AZTEC, HCL, Navsoft,


•How do you create subdomains using PHP?

1 Answers  


What is the full form of PHP?

28 Answers   Apple, Nandhini, PHP,


Categories