---
source: boltffi_bindgen/src/render/swift/templates.rs
assertion_line: 1776
expression: "render_function(&func, \"boltffi\")"
---
public func uploadFile(path: String, to destination: String) async throws -> String {
    var path = path
    var destination = destination
    let futureHandle = path.withUTF8 { pathBuf in destination.withUTF8 { destinationBuf in boltffi_upload_file_start(pathBuf.baseAddress!, UInt(pathBuf.count), destinationBuf.baseAddress!, UInt(destinationBuf.count)) } }
    return try await boltffiAsyncCall(
        futureHandle: futureHandle,
        pollFn: boltffi_upload_file_poll,
        completeFn: boltffi_upload_file_complete,
        cancelFn: boltffi_upload_file_cancel,
        freeFn: boltffi_upload_file_free
    ) { buf, status in
        guard status.code == 0 else { boltffi_free_buf(buf); throw FfiError(message: "FFI failed in async completion with code \(status.code)") }
        defer { boltffi_free_buf(buf) }
        return boltffiDecodeOwnedBuf(buf.ptr, Int(buf.len)) { reader in reader.readString() }
    }
}
