<?php
// 启用详细错误报告
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

echo "<pre>";
echo "=== 上传调试信息 ===\n\n";

// 检查请求方法
echo "请求方法: " . $_SERVER['REQUEST_METHOD'] . "\n\n";

// 检查文件上传
echo "=== 文件上传信息 ===\n";
if (isset($_FILES['video'])) {
    $file = $_FILES['video'];
    echo "文件名称: " . $file['name'] . "\n";
    echo "文件类型: " . $file['type'] . "\n";
    echo "文件大小: " . $file['size'] . " bytes (" . round($file['size'] / 1024 / 1024, 2) . " MB)\n";
    echo "临时文件: " . $file['tmp_name'] . "\n";
    echo "错误码: " . $file['error'] . "\n";
    
    $errorMessages = [
        UPLOAD_ERR_OK => '无错误',
        UPLOAD_ERR_INI_SIZE => '超过php.ini限制',
        UPLOAD_ERR_FORM_SIZE => '超过表单限制',
        UPLOAD_ERR_PARTIAL => '文件部分上传',
        UPLOAD_ERR_NO_FILE => '无文件上传',
        UPLOAD_ERR_NO_TMP_DIR => '无临时目录',
        UPLOAD_ERR_CANT_WRITE => '写入失败',
        UPLOAD_ERR_EXTENSION => '扩展阻止'
    ];
    echo "错误描述: " . (isset($errorMessages[$file['error']]) ? $errorMessages[$file['error']] : '未知') . "\n";
    
    // 检查临时文件是否存在
    if (file_exists($file['tmp_name'])) {
        echo "临时文件存在: 是\n";
        echo "临时文件大小: " . filesize($file['tmp_name']) . " bytes\n";
    } else {
        echo "临时文件存在: 否\n";
    }
} else {
    echo "无上传文件\n";
}

echo "\n=== POST数据 ===\n";
print_r($_POST);

echo "\n=== PHP配置 ===\n";
echo "upload_max_filesize: " . ini_get('upload_max_filesize') . "\n";
echo "post_max_size: " . ini_get('post_max_size') . "\n";
echo "upload_tmp_dir: '" . ini_get('upload_tmp_dir') . "'\n";
echo "max_execution_time: " . ini_get('max_execution_time') . "\n";

echo "\n=== 服务器信息 ===\n";
echo "PHP版本: " . phpversion() . "\n";
echo "服务器软件: " . $_SERVER['SERVER_SOFTWARE'] . "\n";

echo "</pre>";
?>