newrehmi Posted February 24, 2010 Share Posted February 24, 2010 what is the different between basename($_FILES['file']['name']) and $_FILES['file']['name'] both echo the same value rite? so, what is the different between both? thanks Quote Link to comment https://forums.phpfreaks.com/topic/193258-what-is-the-different-between-basename_filesfile-and-_filesfile/ Share on other sites More sharing options...
roopurt18 Posted February 24, 2010 Share Posted February 24, 2010 What happens if something crazy happens, like a forward or backslash being part of the filename? Do they echo the same thing then? Quote Link to comment https://forums.phpfreaks.com/topic/193258-what-is-the-different-between-basename_filesfile-and-_filesfile/#findComment-1017586 Share on other sites More sharing options...
Zane Posted February 24, 2010 Share Posted February 24, 2010 basename() http://us2.php.net/basename returns the filename... and like roopurt mentioned.. if $_FILES['file']['name'] contained a bunch of slashes... using basename would take those out and only return the filename.. Quote Link to comment https://forums.phpfreaks.com/topic/193258-what-is-the-different-between-basename_filesfile-and-_filesfile/#findComment-1017632 Share on other sites More sharing options...
ignace Posted February 24, 2010 Share Posted February 24, 2010 Or in other words: what is the different between basename($_FILES['file']['name']) and $_FILES['file']['name'] directory traversal Quote Link to comment https://forums.phpfreaks.com/topic/193258-what-is-the-different-between-basename_filesfile-and-_filesfile/#findComment-1017634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.