<?php
// 测试上传API
$url = 'http://localhost/yangquan_wedding/api/api_router.php?path=video/upload';

// 模拟上传
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);

// 创建一个临时文件作为测试
$tmpFile = tempnam(sys_get_temp_dir(), 'test_video_');
file_put_contents($tmpFile, str_repeat('x', 1024));

$postData = [
    'video' => new CURLFile($tmpFile, 'video/mp4', 'test.mp4'),
    'video_type' => 'host',
    'video_name' => '测试视频'
];

curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "HTTP状态码: $httpCode\n";
echo "响应内容:\n";
echo $response . "\n";

// 清理临时文件
unlink($tmpFile);
?>