note 62031 deleted from function.basename by googleguy
| From: | googleguy@php.net | Date: | Sat, 12 Jan 2013 09:48:41 +0000 |
| Subject: | note 62031 deleted from function.basename by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192968@lists.php.net to get a copy of this message | ||
Note Submitter: support at rebootconcepts dot com
----
works on windows and linux, faster/easier than amitabh's...
<?php
$basename = preg_replace( '/^.+[\\\\\\/]/', '', $filename );
// Optional; change any non letter, hyphen, or period to an underscore.
$sterile_filename = preg_replace( "/[^\w\.-]+/", "_", $basename );
?>