diff --git a/lib/zip_install.php b/lib/zip_install.php index 4d37468..5deb41f 100644 --- a/lib/zip_install.php +++ b/lib/zip_install.php @@ -430,6 +430,22 @@ public function handleFileUploadWithResult(): array /** @var array{name: string, type: string, tmp_name: string, error: int, size: int} $uploadedFile */ $uploadedFile = $_FILES['zip_file']; + // Check for upload errors + if ($uploadedFile['error'] !== UPLOAD_ERR_OK) { + return [ + 'message' => rex_view::error(rex_i18n::msg('zip_install_upload_failed')), + 'addon_key' => null + ]; + } + + // Check if tmp_name is not empty + if (empty($uploadedFile['tmp_name']) || !is_uploaded_file($uploadedFile['tmp_name'])) { + return [ + 'message' => rex_view::error(rex_i18n::msg('zip_install_upload_failed')), + 'addon_key' => null + ]; + } + // Validate file extension $fileExtension = strtolower(pathinfo($uploadedFile['name'], PATHINFO_EXTENSION)); if ($fileExtension !== 'zip') {