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

# Send files to the viewer

> Send a screenshot, a report or any other file from your Unreal application to the viewer's browser, where it is saved as a download.

Your application can send a file to the viewer while the stream is running. The file travels over the stream's own data channel, and the viewer's browser saves it as a download. No extra server, upload step or frontend code is needed.

Common uses:

* A high-resolution screenshot or render of the current scene.
* A generated document, such as a quote, a specification sheet or a report.
* An exported configuration or save file.

## Before you start

* The **Pixel Streaming** or **Pixel Streaming 2** plugin is enabled in your project. Enable only one of them. The node on this page has the same name in both.
* The viewer is connected and the stream has started. A file sent earlier is not delivered.
* You know where your application can write files at runtime. See [File paths on a streaming server](#file-paths-on-a-streaming-server).

## How it works

**1. Your application calls Send File**

You give the node a file on disk, its type and its extension.

**2. The plugin sends the file in pieces**

The pieces travel over the data channel of the WebRTC connection that carries the stream.

**3. The browser puts the file back together**

The Streampixel player shows the progress, then saves the file to the viewer's device.

## Node reference

### Send File

Sends a file that exists on disk.

| Input | Type | Description |
| - | - | - |
| **Filepath** | String | Full path of the file on the machine that runs your application. |
| **Mime Type** | String | The file's media type, for example `image/png`. The browser uses it to decide how to handle the file. |
| **File Extension** | String | The extension the saved file gets, for example `.png`. Include the dot. |

### Send File as Byte Array

Sends data that is in memory and has not been written to disk. It takes a byte array in place of **Filepath**, with the same **Mime Type** and **File Extension**.

### Common types

| File | Mime Type | File Extension |
| - | - | - |
| PNG image | `image/png` | `.png` |
| JPEG image | `image/jpeg` | `.jpg` |
| PDF document | `application/pdf` | `.pdf` |
| Plain text | `text/plain` | `.txt` |
| CSV table | `text/csv` | `.csv` |
| JSON data | `application/json` | `.json` |
| ZIP archive | `application/zip` | `.zip` |

## Send an existing file

Check that the file exists, then send it.

![Blueprint: a custom event with a File Path input, File Exists, Branch, Send File with mime type text/plain and extension .txt, and a Print String for a missing file](https://mintcdn.com/streampixel/P50ZysebLJoKVimg/images/send-file-text-blueprint.png?fit=max\&auto=format\&n=P50ZysebLJoKVimg\&q=85\&s=62c7816cea8dc3304b301dc48427be3d)

Send a text file when it exists, and report the path when it does not

**1. Create a custom event with a File Path input**

One event can then send any file.

**2. Check the file with File Exists**

Connect the result to a **Branch**.

**3. On True, call Send File**

Connect **File Path** to **Filepath**. Set **Mime Type** and **File Extension** to match the file.

**4. On False, report the problem**

Print or log the path, so a wrong path is easy to spot while testing.

## Send a file your application creates

A file that is still being written cannot be sent. Start the work, wait until the file exists, then send it. This example takes a high-resolution screenshot and sends it to the viewer.

**1. Start the capture**

Build a unique file path, run the `HighResShot` console command with that path, and start a looping timer that checks for the file.

![Blueprint: DoCapture checks and sets a Busy flag, builds Shot Path from a directory, a random number and .png, runs HighResShot through Execute Console Command, and starts a looping timer](https://mintcdn.com/streampixel/P50ZysebLJoKVimg/images/send-file-capture-blueprint.png?fit=max\&auto=format\&n=P50ZysebLJoKVimg\&q=85\&s=c12d22a75e48fbf5dccbbd86d1170bd0)

Build the path, run HighResShot, and start the timer

The **Busy** flag stops a second capture from starting while one is in progress. A random number in the file name keeps two captures from writing to the same file.

**2. Wait for the file, then send it**

Each time the timer fires, count the attempt and check **File Exists**.

* **The file exists:** clear the timer, wait about a second so the write finishes, then call **Send File** with `image/png` and `.png`.
* **The file does not exist yet:** let the timer fire again.
* **Too many attempts:** clear the timer and reset **Busy**, so the application never waits for ever.

![Blueprint: WaitForFile increments Attempts, checks File Exists, clears the timer, delays one second, calls Send File with image/png, and on more than 40 attempts clears the timer and resets Busy](https://mintcdn.com/streampixel/P50ZysebLJoKVimg/images/send-file-wait-and-send-blueprint.png?fit=max\&auto=format\&n=P50ZysebLJoKVimg\&q=85\&s=3985f3c06de0bb8395ec37108f09282b)

Poll for the file, send it, and stop after 40 attempts

## What the viewer sees

On the Streampixel player, including when it is embedded in an iframe:

| Stage | Desktop | iPhone and iPad |
| - | - | - |
| File arriving | A card shows **Receiving…** with the percentage and the amount received. | The same card. |
| File complete | The file downloads automatically. The card offers **Download again**. | The card shows a **Save** button, which opens the system share sheet. |

The saved file is named `capture-<date>-<time>` followed by your extension, for example `capture-20261116-143005.png`. Pixel Streaming sends the type and the extension of a file, not its name.

## File paths on a streaming server

On Streampixel your application runs on a streaming server, not on your computer.

> [!WARNING]
>
> A fixed path such as `D:/MyProject/Exports/file.txt` exists only on your own machine. Build paths at runtime from **Get Project Saved Directory** or **Get Project Directory**, so they are valid on any server.

* **Files are temporary.** A file your application writes on a streaming server is not kept between sessions and is not available on other servers.
* **Sessions move between servers.** The next session may run on a different server.
* **Persistent data belongs in your own storage.** Send it to your backend or to cloud storage, keyed by your own user or account ID.

## Limits and performance

* Files share the connection with the stream and are sent in small pieces. Screenshots and documents arrive within moments.
* A large file takes longer and competes with the video for bandwidth while it is being sent. For large files, give the viewer a link to download from your own storage.
* Send one file at a time. Wait for a transfer to finish before starting the next.

## Troubleshooting

> [accordion] Nothing is downloaded
>
> Check these in order:
>
> 1. **The path.** Print the path and the result of **File Exists** before calling **Send File**. A path that works on your computer may not exist on the streaming server.
> 2. **The timing.** The viewer must be connected and the stream started before the file is sent.
> 3. **The file is complete.** If your application has just created the file, wait until it has finished writing. See [Send a file your application creates](#send-a-file-your-application-creates).

> [accordion] The file is empty or cannot be opened
>
> It was sent while it was still being written. Wait for the file to exist, then add a short delay before **Send File**.

> [accordion] The file has the wrong type or no extension
>
> Set **Mime Type** and **File Extension** to match the file, and include the dot in the extension.

> [accordion] The file name is not the one I used
>
> This is expected. The viewer's file is named `capture-<date>-<time>` with your extension, because Pixel Streaming does not send a file name.

> [accordion] On iPhone or iPad the file does not download by itself
>
> This is expected. The viewer taps **Save** on the card to store the file.

> [accordion] It works in the editor but not on Streampixel
>
> The usual cause is a path that exists only on your computer. Build the path at runtime, and make sure the build is packaged with the content your application reads.

## Next steps

> [card] [Unreal side - sending and receiving JSON](https://docs.streampixel.io/resources/json-message-communication/unreal-side-sending-and-receiving-json.md)
>
> Send values and status messages that are not files.

> [card] [Screenshots](https://docs.streampixel.io/resources/quick-start-guide/screenshot-functionality.md)
>
> Capture the current video frame with one message, without a file.


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