Auto commit: 2025-11-20T12:25:12.227Z
This commit is contained in:
parent
bb853fb0c8
commit
d78986f2c1
16
upload.php
16
upload.php
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
// Temporary error logging
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_log', __DIR__ . '/error_log.txt');
|
||||
|
||||
// Simple success/error JSON response
|
||||
function json_response($status, $message, $data = null) {
|
||||
header('Content-Type: application/json');
|
||||
@ -58,7 +65,14 @@ if (move_uploaded_file($file['tmp_name'], $target_path)) {
|
||||
// Read the file content and base64 encode it
|
||||
$file_content = file_get_contents($target_path);
|
||||
$base64_image = base64_encode($file_content);
|
||||
$mime_type = mime_content_type($target_path);
|
||||
|
||||
// Check if mime_content_type function exists
|
||||
if (function_exists('mime_content_type')) {
|
||||
$mime_type = mime_content_type($target_path);
|
||||
} else {
|
||||
// Fallback to a generic MIME type if the function doesn't exist
|
||||
$mime_type = 'application/octet-stream';
|
||||
}
|
||||
|
||||
$resp = LocalAIApi::createResponse([
|
||||
'input' => [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user