Get file name with php

DescriptionPHP snippet by - 08/22/10

The the basename or dirname functions to easily access file and directory names using php. This is a good way to create css classes from file names.

Tags ,

$full_path = '/swf/myflashfile.swf';
$file = basename($full_path);  // $file is "myflashfile.swf'"
$dir  = dirname($full_path);   // $dir is "/swf/myflashfile.swf'"
  • Share
Submitted by: Adam J Nowak
http://hyperspatial.com

Comments and Feedback