我有一个函数尝试检索上传文件的大小,但当文件名包含特殊字符(如法语、俄语或中文字符)时,该函数失败:
-
5b99109c1a10eèé·§·.pdf
-
-
5b99140a5a47d_手册CVI3(法语§ais).pdf
SplFileInfo::getSize():C:\wamp\www\DESiwid\app/。/web/uploads/documents\5b99104337d6b_K°°2016.pdf的stat失败
这是我的代码:
/**
* @param Document $document
* @return int
*/
private function getSize(Document $document)
{
/* retrieve Symfony\Component\HttpFoundation\File\File $file from entity */
$file = $document->getFileFile();
/* return file size */
return $file->getSize();
}