bobo
bobo

Reputation: 8727

move_uploaded_file does not support utf8 file name

I am using uploadify and the file name retrieved from $_FILES["fileData"]["name"] on server side is in utf8. It may contain chinese or japanese characters. After the following codes run,

$tempFileWithPath = $_FILES['Filedata']['tmp_name'];
$destFile = $_FILES['Filedata']['name'];

$destFileWithPath=myUtility::getFileRepositoryPath().'/'.$destFile;
move_uploaded_file($tempFileWithPath,$destFileWithPath);

For those files using chinese or japanese file name, I used filezilla ftp client (which supports utf8 file name) and browser the folder and found that they all become ?????. Of course, other files using english-only file name do not have this problem.

I am using php 5.2.9 and the server is linux on a shared hosting.

Is it true that all file-related functions in PHP have problems supporting utf8? Or my problem is related to other issues?

Upvotes: 2

Views: 4443

Answers (1)

Peter Bailey
Peter Bailey

Reputation: 105888

The target filesystem has to support the encoding as well - this may have nothing to do with uploadify or PHP at all.

Upvotes: 2

Related Questions