php - 无法在智能手机中获取文件的 tmp_name ($_FILES)

标签 php arrays file

这是我的 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/

相关文章:

java - 使用 HashMap 读取/写入 txt 文件 - 小修复

php - 扩展 Doctrine Entity 以添加业务逻辑

php - 如果数组值彼此匹配,则再次随机播放

c - 将结构体指针数组传递给函数

php - 检查数组以查找公共(public)数据

python - 我怎么知道 python 3 使用的是 cPickle 还是 Pickle?

javascript - 从 mySql 数据库在 php 中返回 JSON

php - 如果我在一个 sh 文件中有 2 个 php 脚本,我可以确定第二个脚本只会在第一个脚本完成后才开始运行吗?

c# - 将 JSON 数组发布到 mvc Controller

file - Yii2上传的音频文件未保存在上传文件夹中