<?php $path = "./test.txt"; $filename = basename($path); $filename2 = basename($path, ".txt"); echo $filename; echo "<BR>"; echo $filename2;?>