<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/storage-types](./storage-types.md) &gt; [UploadTask](./storage-types.uploadtask.md) &gt; [then](./storage-types.uploadtask.then.md)

## UploadTask.then() method

This object behaves like a Promise, and resolves with its snapshot data when the upload completes.

<b>Signature:</b>

```typescript
then(
    onFulfilled?: ((snapshot: UploadTaskSnapshot) => any) | null,
    onRejected?: ((error: FirebaseStorageError) => any) | null
  ): Promise<any>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  onFulfilled | ((snapshot: [UploadTaskSnapshot](./storage-types.uploadtasksnapshot.md)<!-- -->) =&gt; any) \| null | The fulfillment callback. Promise chaining works as normal. |
|  onRejected | ((error: [FirebaseStorageError](./storage-types.firebasestorageerror.md)<!-- -->) =&gt; any) \| null | The rejection callback. |

<b>Returns:</b>

Promise&lt;any&gt;

