# sync-basalam/1.9.0/includes/Services/Ticket/UploadTicketMedia.php

ووسلام – همگام سازی ووکامرس و باسلام, version 1.9.0. 30 lines.

- Page: https://pluginprobe.com/plugins/sync-basalam/1.9.0/code/includes/Services/Ticket/UploadTicketMedia.php
- Raw: https://pluginprobe.com/plugins/sync-basalam/1.9.0/raw/includes/Services/Ticket/UploadTicketMedia.php
- Modified: 2026-06-21T07:48:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sync-basalam/1.9.0/code/includes/Services/Ticket/UploadTicketMedia.php#L10-L20`.

```php
<?php

namespace SyncBasalam\Services\Ticket;

use SyncBasalam\Config\Endpoints;
use SyncBasalam\Services\ApiServiceManager;

defined('ABSPATH') || exit;

class UploadTicketMedia
{
    private $url = Endpoints::TICKET_MEDIA_UPLOAD;

    public function execute($hamsalamToken, $filePath)
    {
        $apiService = syncBasalamContainer()->get(ApiServiceManager::class);
        $header = ['Authorization' => 'Bearer ' . $hamsalamToken];

        try {
            $apiService->upload($this->url, $filePath, [], $header);
        } catch (\Exception $e) {
            return [
                'status_code' => $e->getCode() ?? 500,
                'body' => null,
                'error' => 'خطا در آپلود فایل: ' . $e->getMessage(),
            ];
        }
    }
}

```
