|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-03-17 09:28 UTC] zamorov at edinorog dot ru
Description:
------------
basename not work correctly with windows path
Reproduce code:
---------------
$win = basename('C:\Windows\win.ini');
$unix = basename('/usr/local/etc/win.ini');
Expected result:
----------------
$win = 'win.ini';
$unix = 'win.ini';
Actual result:
--------------
$win = 'C:\Windows\win.ini';
$unix = 'win.ini';
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 10:00:01 2025 UTC |
Sample. I'm upload file from windows to unix. $_FILES[etc]['name'] contain path with backslash, but basename understand only forward slash. Use $imageName =& array_pop(split('/', strtr($_FILES['image']['name'], array('\\' => '/')))); rather than $imageName =& basename($_FILES['image']['name']); wise choice?