我试图在我的网站目录中的新文件夹中自动传输文件我使用此代码:
$errors = array();
foreach($_FILES['files']['tmp_name'] as $key => $tmp_name) {
$file_name = $_FILES['files']['name'][$key];
$file_size = $_FILES['files']['size'][$key];
$file_tmp = $_FILES['files']['tmp_name'][$key];
$file_type = $_FILES['files']['type'][$key];
if($file_size > 2097152) {
$errors[] = 'File size must be less than 2 MB';
}
$connexion -> exec("INSERT INTO user_details (USER_ID, FILE_NAME, FILE_SIZE, FILE_TYPE, NOM, PRENOM, choix) VALUES ('', '$file_name', '$file_size', '$file_type', '$NOM', '$PRENOM', '$choix';
收到此错误消息:
Warning: Invalid argument supplied for foreach() in /srv/disk5/2035382/www/olexim.co.nf/traitement.php on line 30