---
title: "upload(_:)"
framework: TelephonyMessagingKit
role: symbol
role_heading: Instance Method
platforms: [iOS 26.0+]
path: "telephonymessagingkit/rcsservice/upload(_:)"
---

# upload(_:)

Uploads a file to the RCS content server.

## Declaration

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

## Parameters

- `uploadRequest`: A doc://com.apple.telephonymessagingkit/documentation/TelephonyMessagingKit/RCSService/FileUploadRequest instance that describes the file to upload and an optional thumbnail.

## Return Value

Return Value A RCSService.FileUploadRequest.Metadata instance that contains information about the uploaded file.

## Discussion

Discussion Sending a file to a recipient over RCS is a two-step process: Call upload(_:) to upload the file to the carrier. Send a message of type RCSMessage.FileTransfer to the recipient, using metadata returned from the upload step. The following example shows this process: 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)) note: If RCS file transfer isn’t supported, this method throws RCSService.Error.notSupported. If the file exceeds the maximum size, it throws RCSService.Error.maximumSizeExceeded.

## See Also

### Transferring files

- [RCSService.FileUploadRequest](telephonymessagingkit/rcsservice/fileuploadrequest.md)
- [RCSService.FileUploadRequest.Metadata](telephonymessagingkit/rcsservice/fileuploadrequest/metadata.md)
- [download(_:)](telephonymessagingkit/rcsservice/download(_:).md)
- [RCSService.FileDownloadRequest](telephonymessagingkit/rcsservice/filedownloadrequest.md)
- [RCSService.FileDownloadRequest.Metadata](telephonymessagingkit/rcsservice/filedownloadrequest/metadata.md)
