# Upload a file to a session
`PUT https://vod-uploads-middleware-api.livepush.io/uploads/{session_id}`
Sends the video file. The body is the raw file bytes, not a form and not JSON, streamed straight into storage. The response arrives once the whole file has been written, so set no client timeout (or a very long one) on this request.

The session is consumed by the first request to it, whether or not the upload succeeds. To retry a failed upload, call [Create an upload session](/videos/create-an-upload-session/) again with the same upload specification.

On `{"success": true}`, finish with [Register an uploaded video](/videos/register-an-uploaded-video/).
- **Tag:** Videos
- **Operation ID:** `uploadFileToSession`
- **Authentication:** Bearer token required
- **Docs:** https://developers.livepush.io/videos/upload-a-file-to-a-session/

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `session_id` | string | yes | Last path segment of the uploadUrl returned by Create an upload session. |


### Request body

`application/octet-stream` (required)

The raw bytes of the file.


### Example request

```bash
curl -X PUT 'https://vod-uploads-middleware-api.livepush.io/uploads/Qe8rT2pZx' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/octet-stream' \
  --data-binary '@video.mp4'
```


### Responses


#### 200 — The file was written to storage.

- `success` (boolean)
- `error` (boolean) — Present and true when the file could not be written to storage.


```json
{
  "success": true
}
```


#### 400 — The session does not exist, has expired or was already used (unsigned request), or the file could not be written to storage (success: false). Create a new session and upload again.


```json
{
  "error": "unsigned request"
}
```


#### 401 — Missing or invalid bearer token.


```json
{
  "error": "unauthorized"
}
```

