php 通过 mime 上传 xml 文件的文件限制

问题描述 投票:0回答:3
php xml upload xampp mime
3个回答
0
投票

对于 xml 文件,似乎

$finfo->file()
返回
application/xml
而不是
text/xml

将具有有效 mime 类型的数组更改为:

array(
    'xml' => 'application/xml',
    'txt' => 'text/plain',
),

0
投票

这对我有用......

'xml' => ['text/xml', 'application/xml'],
'txt' => 'text/plain',

-1
投票

尝试使用下面的代码。文件的扩展名在您的代码上正确。

if (!move_uploaded_file( $_FILES['upfile']['tmp_name'], 'uploads/'.basename($_FILES["upfile"]["name"] ) ))

© www.soinside.com 2019 - 2024. All rights reserved.