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

时间:2017-11-09 14:21:08

标签: 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] => 
    )

 )

1 个答案:

答案 0 :(得分:2)

您没有tmp_name的原因是因为上传失败,错误代码为1,表示文件太大。请参阅:upload file error codes

  

UPLOAD_ERR_INI_SIZE值:1;上传的文件超过了   php.ini中的upload_max_filesize指令。