I'm trying to get only the filename of the path using PHP code. I have used glob() function but its returning me this result:
C:\Users\HP\Desktop\CSVFiles\672VER.csvC:\Users\HP\Desktop\CSVFiles\ACC1.csvC:\Users\HP\Desktop\CSVFiles\EMP.csv
I only want to get 672VER, ACC1 and EMP
Anyone can help me in doing this? :( I was up until morning just trying to figure out this code.
Here's my code
$files = array();
foreach (glob("C:\Users\HP\Desktop\CSVFiles\*.csv") as $file1) {
$files[] = $file1;
echo $file1;
}
Update: I went to this link How to get file name from full path with PHP? and it didnt get me the result I want.... It only gave me an asterisk(*) sign...