当它突然停止时,它完全正常。我不记得在剧本的这一部分改变了什么,所以它非常奇怪。
$target_dir = "./files/tickets/" . $_SESSION['username'] . "/" . $ticketNumber['ticket_number'];
foreach ($_FILES['ticketFiles']['error'] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES['ticketFiles']['tmp_name'][$key];
$name = basename($_FILES['ticketFiles']['name'][$key]);
if (!is_dir($target_dir)) {
mkdir($target_dir, 0777, true);
}
if (move_uploaded_file($tmp_name, "$target_dir/$name")) {
//move_uploaded_file($tmp_name, "$target_dir/$name");
$_SESSION['message'] .= "File " . $name . " have been successfully uploaded.<br>";
} else {
$_SESSION['message'] .= "There was an error uploading file " . $name . ". Try again please.";
$uploadOk = 0;
}
}
}
目录已创建但未显示任何文件。 &#34;成功上传&#34;消息也会显示。