dsc80135
2019-06-08 10:24
浏览 70

move_uploaded_file在循环中不起作用

My code is:

for($i = 0; $i < count($_FILES['creative']['name']['icon']); $i++) {
    $name = mt_rand(0, time());
    move_uploaded_file($_FILES['creative']['tmp_name']['icon'] 
    [$i],'creatives/'.$name.'.png');
    move_uploaded_file($_FILES['creative']['tmp_name']['image'] 
    [$i],'creatives/'.$name.'.png');
}

The problem is that in this code only the last move_uploaded_file works and uploads an image.

Can you explain me why the first move_uploaded_file does not work?

1条回答 默认 最新

相关推荐 更多相似问题