I have a system where a user uploads documents (pdf, word) etc. The problem being, foreign users are uploading filenames in arabic, chinese, japanese and the system, being able to handle them, is adding them to the database.
Where the problem arises is trying to download the files using php:
$result = mysql_query($query) or die('Error, query failed');
list($filename, $type, $filesize, $filepath) = mysql_fetch_array($result);
header("Content-Disposition: attachment; filename=$filename");
header("Content-length: $filesize");
header("Content-type: $type");
readfile($filepath);
The system isn't recognising the filename, thus won't download the file. Any suggestions?