$file) { if ($file['error'] !== UPLOAD_ERR_OK) { continue; } // 只取文件名,防路径穿越 $name = basename($file['name']); if ($name === '') { continue; } // 加时间戳前缀,避免覆盖 $outName = date('Ymd_His') . '_' . $field . '_' . $name; $outPath = $saveDir . '/' . $outName; if (move_uploaded_file($file['tmp_name'], $outPath)) { $saved[] = $outPath; error_log("[保存] $outPath (" . filesize($outPath) . " bytes)"); } } // 记录一下普通表单字段(方便排查) if (!empty($_POST)) { error_log("[表单] " . json_encode($_POST, JSON_UNESCAPED_UNICODE)); } http_response_code(200); echo "OK";