<!--
{
  "availability" : [
    "iOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TelephonyMessagingKit",
  "identifier" : "/documentation/TelephonyMessagingKit/RCSService/upload(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TelephonyMessagingKit"
    ],
    "preciseIdentifier" : "s:21TelephonyMessagingKit10RCSServiceC6uploadyAC17FileUploadRequestV8MetadataVAFYaKF"
  },
  "title" : "upload(_:)"
}
-->

# upload(_:)

Uploads a file to the RCS content server.

```
final func upload(_ uploadRequest: RCSService.FileUploadRequest) async throws -> RCSService.FileUploadRequest.Metadata
```

## Parameters

`uploadRequest`

A [`RCSService.FileUploadRequest`](/documentation/TelephonyMessagingKit/RCSService/FileUploadRequest) instance that describes the file to upload and an optional thumbnail.

## Return Value

A [`RCSService.FileUploadRequest.Metadata`](/documentation/TelephonyMessagingKit/RCSService/FileUploadRequest/Metadata) instance that contains information about the uploaded file.

## Discussion

Sending a file to a recipient over RCS is a two-step process:

1. Call `upload(_:)` to upload the file to the carrier.
2. Send a message of type [`RCSMessage.FileTransfer`](/documentation/TelephonyMessagingKit/RCSMessage/FileTransfer) to the recipient, using metadata returned from the upload step.

The following example shows this process:

```swift
let service = TelephonyMessagingSession.shared.rcsService

let cellularServices = try TelephonyMessagingSession.shared.cellularServices
let cellularServiceID = cellularServices[0].id

guard service.isViable(for: cellularServiceID) else { return }
guard let uploadURL = URL(string: SAMPLE_UPLOAD_FILE_PATH) else { return }

// Upload file.
let request = RCSService.FileUploadRequest(cellularServiceID: cellularServiceID,
                                                 fileURL: uploadURL,
                                                 contentType: UTType.plainText)
let uploadMetadata = try await service.upload(request)

// Send file transfer message to recipient handle, using upload metadata.
try await service.sendMessage(RCSMessage.FileTransfer(fileMetadata: uploadMetadata.fileMetadata),
                    to: RCSHandle.phoneNumber(SAMPLE_PHONE_NUMBER)!,
                    using: cellularServiceID,
                    messageID: RCSMessageID(rawValue: SAMPLE_RCS_MESSAGE_ID))
```

> Throws:
> If RCS file transfer isn’t supported, this method throws ``doc://com.apple.telephonymessagingkit/documentation/TelephonyMessagingKit/RCSService/Error/notSupported``. If the file exceeds the maximum size, it throws ``doc://com.apple.telephonymessagingkit/documentation/TelephonyMessagingKit/RCSService/Error/maximumSizeExceeded``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)