> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FileUploadListener

> FileUploadListener — Kinetica Rust API

[gpudb\_api](https://docs.kinetica.com/content/api/rust/index.md)::<wbr />[filesystem](https://docs.kinetica.com/content/api/rust/filesystem/index.md)
[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L37-L89)&#x20;

<pre>`pub trait FileUploadListener: Send + Sync {    // Required methods    fn on_multi_part_upload_complete(&self, results: Vec<OperationResult>);    fn on_part_upload(&self, result: OperationResult);    fn on_full_file_upload(&self, result: OperationResult);    // Provided method    fn on_multi_part_upload_cancel(&self, results: Vec<OperationResult>) { ... }}`</pre>

Listener trait for file upload progress callbacks.Implement this trait to receive notifications about upload progress, including per-part completion for multi-part uploads.

## Example

```rust theme={null}
use gpudb_api::filesystem::{FileUploadListener, OperationResult};

struct MyUploadListener;

impl FileUploadListener for MyUploadListener {
    fn on_multi_part_upload_complete(&self, results: Vec<OperationResult>) {
        println!("Multi-part upload complete with {} parts", results.len());
    }

    fn on_part_upload(&self, result: OperationResult) {
        if let Some(info) = &result.upload_info {
            println!("Uploaded part {} of {}", info.upload_part_number, info.total_parts);
        }
    }

    fn on_full_file_upload(&self, result: OperationResult) {
        if result.successful {
            println!("Uploaded: {:?}", result.full_file_names);
        } else {
            println!("Upload error: {:?}", result.error_message);
        }
    }
}
```

## Required Methods

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L48)
fn [on\_multi\_part\_upload\_complete](#tymethod.on_multi_part_upload_complete)(\&self, results: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md)>)

Called when all parts of a multi-part upload have been completed.The list holds a result for every stage of the job, in order: the initiating stage, one per uploaded part, and the completing stage. Only the completing stage names the uploaded file in `full_file_names`. Use `upload_info` to tell the stages apart.

##### Arguments

<ul>
  <li>`results` - List of results for each stage of the upload</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L74)
fn [on\_part\_upload](#tymethod.on_part_upload)(\&self, result: [OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md))

Called whenever a single part of a multi-part upload has been completed.This is useful for tracking progress during large file uploads. It is called for the data parts only, not for the initiating or completing stages.

##### Arguments

<ul>
  <li>`result` - Result of the part upload</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L88)
fn [on\_full\_file\_upload](#tymethod.on_full_file_upload)(\&self, result: [OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md))

Called for each batch of whole files sent in one request, as it finishes, and for each file that could not be read to be sent.For a batch sent, `full_file_names` lists its files and `file_name` is empty; if the request failed, `successful` is false and `error_message` says why. For a file that could not be read, `file_name` is its local name and `error_message` says why.

##### Arguments

<ul>
  <li>`result` - Result of the upload operation</li>
</ul>

## Provided Methods

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L61-L63)
fn [on\_multi\_part\_upload\_cancel](#method.on_multi_part_upload_cancel)(\&self, results: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md)>)

Called when a multi-part upload was aborted because one of its stages failed after it had been initiated.The list holds a result for every stage that completed before the failure, followed by the cancelling stage. It is informational only: the failure is also reported in the upload’s returned error. Not called when the cancel request itself fails. By default it does nothing.

##### Arguments

<ul>
  <li>`results` - List of results for each stage, ending with the cancel</li>
</ul>

## Dyn Compatibility

This trait is [dyn compatible](https://doc.rust-lang.org/1.98.1/reference/items/traits.html#dyn-compatibility).In older versions of Rust, dyn compatibility was called "object safety".

## Implementors

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L278-L282)
impl [FileUploadListener](https://docs.kinetica.com/content/api/rust/filesystem/trait.FileUploadListener.md) for [NoOpUploadListener](https://docs.kinetica.com/content/api/rust/filesystem/struct.NoOpUploadListener.md)

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/filesystem/listeners.rs#L190-L207)

### impl\<F1, F2, F3>[FileUploadListener](https://docs.kinetica.com/content/api/rust/filesystem/trait.FileUploadListener.md) for [FnUploadListener](https://docs.kinetica.com/content/api/rust/filesystem/struct.FnUploadListener.md)\<F1, F2, F3>&#xA;where F1: [Fn](https://doc.rust-lang.org/1.98.1/core/ops/function/trait.Fn.html)([Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md)>) + [Send](https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html) + [Sync](https://doc.rust-lang.org/1.98.1/core/marker/trait.Sync.html), F2: [Fn](https://doc.rust-lang.org/1.98.1/core/ops/function/trait.Fn.html)([OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md)) + [Send](https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html) + [Sync](https://doc.rust-lang.org/1.98.1/core/marker/trait.Sync.html), F3: [Fn](https://doc.rust-lang.org/1.98.1/core/ops/function/trait.Fn.html)([OperationResult](https://docs.kinetica.com/content/api/rust/filesystem/struct.OperationResult.md)) + [Send](https://doc.rust-lang.org/1.98.1/core/marker/trait.Send.html) + [Sync](https://doc.rust-lang.org/1.98.1/core/marker/trait.Sync.html),


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.