初始化内容

This commit is contained in:
2026-09-16 14:07:40 +08:00
parent 6934b390bf
commit 4f643c1e7c
18350 changed files with 6088489 additions and 305 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
// 保存目录(相对于网站根目录,或写绝对路径)
$saveDir = __DIR__ . '/uploads';
if (!is_dir($saveDir)) {
mkdir($saveDir, 0755, true);
}
$saved = [];
// $_FILES 里是所有上传的文件,不管字段名叫 crashrpt 还是 file
foreach ($_FILES as $field => $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";