Currently user can upload files as they like. So in the uploaded files there are spaces, characters like ß, ü
and so on. Than other users can download these files (including white spaces in the URL and so on). It works in this way but according to RFC1738 - Uniform Resource Locators (URL) only alphanumeric characters [a-zA-Z0-9]
and some special/reserved characters are allowed. Also empty spaces should be avoided I think.
Currently I get for a ß
a ß
in the file name on the server. The user who wants to download the file gets the correct character (ß) represented from the MySQL database (utf8_unicode_ci) and so the file can be found on the server.
- What is the correct way to handle file names?
- Should I make a filename check and disallow the upload?
- Should I rename the files on the server after the user upload (e.g.
str_replace()
,urlencode()
, ...)?