<?php
echo "测试简化上传API...\n\n";

// 创建测试文件
$tmpFile = tempnam(sys_get_temp_dir(), 'test_video_');
file_put_contents($tmpFile, str_repeat('x', 1024 * 1024)); // 1MB

echo "创建测试文件: $tmpFile\n\n";

// 测试上传
$url = 'http://localhost/yangquan_wedding/api/upload_video_simple.php';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);

$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);
$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);
?>