Files
crm.clientright.ru/debug_upload_web.php

46 lines
1.3 KiB
PHP
Raw Normal View History

<?php
// Тест загрузки файла через веб-интерфейс
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo "=== Тест загрузки файла через веб ===\n";
// Создаем временный файл
$test_file = '/tmp/debug_upload.txt';
file_put_contents($test_file, 'Debug upload test content');
try {
// Загружаем vTiger
require_once 'config.inc.php';
require_once 'include/utils/utils.php';
echo "✅ vTiger загружен успешно\n";
// Создаем Documents объект
$documents = new Documents();
echo "✅ Documents объект создан успешно\n";
// Тестируем uploadAndSaveFile
$request = new stdClass();
$request->file = array(
'name' => 'debug_upload.txt',
'type' => 'text/plain',
'tmp_name' => $test_file,
'error' => 0,
'size' => filesize($test_file)
);
echo "✅ Тест завершен успешно\n";
} catch (Exception $e) {
echo "❌ Ошибка: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}
// Удаляем временный файл
if (file_exists($test_file)) {
unlink($test_file);
}
?>