gpt4 book ai didi

php - $_FILES 中的某些键为空

转载 作者:太空宇宙 更新时间:2023-11-04 15:46:50 24 4
gpt4 key购买 nike

所以我正在为我妈妈开发一个网站,她想从她的相机上传照片,我首先用我在计算机上找到的一张普通图片测试了我的代码,该图片是在 photoshop CS6 和 $_FILES 数组中创建的没关系:

array ( 'img' => array ( 'name' => array ( 0 => 'pic01.jpg', ), 'type' => array ( 0 => 'image/jpeg', ), 'tmp_name' => array ( 0 => 'D:\\xampp\\tmp\\phpF0F7.tmp', ), 'error' => array ( 0 => 0, ), 'size' => array ( 0 => 6311, ), ), )

但是当我尝试上传我和她手机的照片时,我得到以下数组:

array ( 'img' => array ( 'name' => array ( 0 => 'IMG_20180228_143837.jpg', ), 'type' => array ( 0 => '', ), 'tmp_name' => array ( 0 => '', ), 'error' => array ( 0 => 1, ), 'size' => array ( 0 => 0, ), ), )

如您所见,类型、tmp_name 和大小为空或不正确(大小不正确)。我还看到错误数组值从 0 更改为 1。

这两个数组导出都是由 var_export($_FILES);

我使用以下 HTML 代码上传图片:

<form method="post" action="updateproduct.php" enctype="multipart/form-data">{
<input name="img[]" id="fileupload" type="file" multiple />

我希望我已经提供了足够的信息,如果没有请说出来。

最佳答案

$_FILES 数组中的错误值为 1 表示您已超出服务器施加的文件大小限制:

UPLOAD_ERR_INI_SIZE

Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

Source

关于php - $_FILES 中的某些键为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54786265/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com