Using basename() is not locale safe

Non-US-ASCII characters are stripped out of uploaded filenames. PHP's basename() does not properly support streams or filenames beginning with international characters.
Merge pull request #66 from vsychov/master

Using basename() is not locale safe