Update: 2026-05-04 01:59:47
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
// 1. Basic Constants
|
||||
define('ROOT_PATH', dirname(__DIR__, 2));
|
||||
define('ROOT_PATH', realpath(dirname(__DIR__, 2)));
|
||||
define('APP_PATH', ROOT_PATH . '/app');
|
||||
define('STORAGE_PATH', ROOT_PATH . '/storage');
|
||||
|
||||
|
||||
@@ -36,12 +36,17 @@ if (!$stmt->fetch()) {
|
||||
|
||||
// 4. Handle File Upload
|
||||
$dateFolder = date('Y-m-d');
|
||||
$uploadDir = STORAGE_PATH . '/invoices/' . $tenantId . '/' . $companyId . '/' . $dateFolder . '/';
|
||||
$baseInvoicesDir = STORAGE_PATH . '/invoices';
|
||||
if (!is_dir($baseInvoicesDir)) {
|
||||
mkdir($baseInvoicesDir, 0777, true);
|
||||
}
|
||||
|
||||
$uploadDir = $baseInvoicesDir . '/' . $tenantId . '/' . $companyId . '/' . $dateFolder . '/';
|
||||
|
||||
if (!is_dir($uploadDir)) {
|
||||
if (!mkdir($uploadDir, 0777, true)) {
|
||||
error_log("UPLOAD ERROR: Failed to create directory: " . $uploadDir);
|
||||
json_error('فشل في إنشاء مجلد التخزين', 500);
|
||||
json_error('فشل في إنشاء مجلد التخزين: ' . $uploadDir, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user