PHP File Upload - Processing Arabic / Chinese / Japanese File Names

I have a system in which the user uploads documents (pdf, word), etc. The problem is that foreign users upload file names in Arabic, Chinese, Japanese and the system, being able to handle them, add them to the database,

In case of a problem, it tries to upload 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 does not recognize the file name, therefore, it will not download the file. Any suggestions?

+3
source share
3 answers

, , , . , ( ) , {id}. {Extension}.

: , .

+3

Unicode, (, 我 是 神.doc) php 5 linux, ,

- , {file-id}.doc (, ) , , ,

+1

MySQL, , , utf8_unicode_ci. mysql_query("SET NAMES utf8"); . , Unicode.

Content-Disposition -ASCII , : " Content-Disposition HTTP?"

+1

Source: https://habr.com/ru/post/1712070/


All Articles