diff --git a/backend/auth/syria/uploadImage.php b/backend/auth/syria/uploadImage.php index d084d80..e1ba801 100644 --- a/backend/auth/syria/uploadImage.php +++ b/backend/auth/syria/uploadImage.php @@ -59,6 +59,20 @@ if (!$result['success']) { jsonError($result['error']); } +// --------- إزالة العشوائية من اسم الملف --------- +// الاسم يكون فقط: {driverID}_{imageType}.jpg (بدون random hex) +$ext = pathinfo($result['filename'], PATHINFO_EXTENSION); +$simpleName = $prefix . '_' . $imageType . '.' . $ext; +$simplePath = rtrim($targetDir, '/') . '/' . $simpleName; + +if (file_exists($simplePath)) { + unlink($simplePath); // overwrite +} +rename($result['path'], $simplePath); + +$result['filename'] = $simpleName; +$result['path'] = $simplePath; + // --------- بناء الرابط العام --------- $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; $host = getenv('APP_DOMAIN') ?: ($_SERVER['HTTP_HOST'] ?? 'api.siromove.com');