这是我的 html 表单:
<form method="post" action="filename.php" enctype="multipart/form-data">
<input id="file_upload" name="image[]" value="Upload" multiple="" type="file">
<button type="submit">Submit</button>
</form>
当我在 filename.php 文件中打印 $_FILES 时,我可以在 PC 中获取以下数组:
Array
(
[name] => Array
(
[0] => Sket-printed-shirt.jpg
)
[type] => Array
(
[0] => image/jpeg
)
[tmp_name] => Array
(
[0] => /tmp/phpSA6YF5
)
[error] => Array
(
[0] => 0
)
[size] => Array
(
[0] => 280515
)
)
但在智能手机中低于阵列,例如:摩托罗拉 G4 plus、G5 plus 和 HTC one mini 2
Array
(
[name] => Array
(
[0] => Sket-printed-shirt.jpg
)
[type] => Array
(
[0] => image/jpeg
)
[tmp_name] => Array
(
[0] =>
)
[error] => Array
(
[0] => 1
)
[size] => Array
(
[0] =>
)
)
最佳答案
您没有 tmp_name
的原因是上传失败,错误代码为 1
,这表明文件太大。请参阅:upload file error codes .
UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
关于php - 无法在智能手机中获取文件的 tmp_name ($_FILES),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47204209/