Reputation: 179
$_FILES['userfile']['name']
will return the extension. Is there a way to get just the name (no extension) besides using pathinfo()['filename']
?
For context, I want to create a directory with mkdir
based on a filename. Say you upload a zip file called bobby
, I want to make a directory called bobby, not bobby.zip.
Upvotes: 0
Views: 1872
Reputation: 341
This should do the trick:
echo basename(__FILE__, '.php');
edit My excuse, did not read it good.
pathinfo($filename, PATHINFO_FILENAME)
should to the trick!
Upvotes: 4