【问题标题】:move_uploaded_file does not support utf8 file namemove_uploaded_file 不支持 utf8 文件名
【发布时间】:2009-10-23 19:15:15
【问题描述】:

我正在使用uploadify,并且从服务器端的 $_FILES["fileData"]["name"] 检索到的文件名是 utf8。它可能包含中文或日文字符。以下代码运行后,

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

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

对于那些使用中文或日文文件名的文件,我使用filezilla ftp客户端(支持utf8文件名)并浏览文件夹,发现它们都变成了?????。当然,其他使用纯英文文件名的文件没有这个问题。

我使用的是 php 5.2.9,服务器是共享主机上的 linux。

是不是PHP中所有文件相关的函数都支持utf8有问题?还是我的问题与其他问题有关?

【问题讨论】:

    标签: php utf-8 file-upload


    【解决方案1】:

    目标文件系统也必须为support the encoding - 这可能与uploadify 或PHP 完全无关。

    【讨论】:

    • 我认为你是对的,我检查了服务器使用 ANSI_X3.4-1968 而不是 utf-8 作为其默认字符集,也许 ftp 客户端从服务器知道这一点,所以它会不显示在 utf8 中,导致一些问号。
    猜你喜欢
    • 1970-01-01
    • 2016-12-28
    • 2022-06-23
    • 1970-01-01
    • 2019-01-29
    • 2014-02-08
    • 2018-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多