gpt4 book ai didi

php - 如何通过恒定的上传路径上传多个图像

转载 作者:行者123 更新时间:2023-11-29 22:08:34 25 4
gpt4 key购买 nike

我使用下面的代码上传多张图像,但当我通过不同的表单字段上传多张图像时显示错误。我的代码是:

$image = 'image'.$i.$j;
$image_store = $_FILES[$image]['name'];
define('uploadpath','../images/');
$target = uploadpath. $image_store ;

错误是

CONSTANT uploadpath Already defined

最佳答案

就像错误所说,由于这一行,您多次定义 uploadpath :

define('uploadpath','../images/');

它一定在某个地方循环。从那里删除它(您只需要定义它一次,因此将其放在循环之外),或者进行检查:

if(!defined('uploadpath')) define('uploadpath','../images/');

关于php - 如何通过恒定的上传路径上传多个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31908199/

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