# useUploadPieces

> **useUploadPieces**(`props?`): `UseMutationResult`\<\{ `confirmations`: `object`[]; `failed`: `object`[]; `pieces`: `object`[]; \}, [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error), [`UseUploadPiecesVariables`](/reference/filoz/synapse-react/interfaces/useuploadpiecesvariables/), `unknown`\>

Defined in: [synapse-react/src/warm-storage/use-upload-pieces.ts:106](https://github.com/FilOzone/synapse-sdk/blob/628d3a8812e8612a183a3abe3328169fb741260b/packages/synapse-react/src/warm-storage/use-upload-pieces.ts#L106)

Upload files to an existing data set with synapse-core only (`SP.uploadPieces`).

Each file is streamed to the data set's provider, which computes its PieceCID. All parked pieces are added to the
data set in one signed add-pieces request, and the hook waits for the transaction to be confirmed. Files that fail
are returned in `failed`; the others are still added.

Signs with `sessionKey` when given, otherwise with the connected wallet.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `props?` | [`UseUploadPiecesProps`](/reference/filoz/synapse-react/interfaces/useuploadpiecesprops/) | The props to use. [UseUploadPiecesProps](/reference/filoz/synapse-react/interfaces/useuploadpiecesprops/) |

## Returns

`UseMutationResult`\<\{ `confirmations`: `object`[]; `failed`: `object`[]; `pieces`: `object`[]; \}, [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error), [`UseUploadPiecesVariables`](/reference/filoz/synapse-react/interfaces/useuploadpiecesvariables/), `unknown`\>

The upload mutation. [UseUploadPiecesResult](/reference/filoz/synapse-react/interfaces/useuploadpiecesresult/)