# Generic file transfer from UE to Frontend

While primarily used for capturing and downloading screenshots, this blueprint logic provides a generic framework to transfer *any* file generated by the engine during a Pixel Streaming session directly to the end-user's local machine.

## Feature Overview

The Generic File Transfer system leverages Arcware’s custom communication layer to send binary data or file paths from the Unreal Engine instance to the browser.

* How it works: The engine generates a file (e.g., a `.png`, `.pdf`, or `.txt`), identifies its location on the server, reads the data, and triggers a "Pixel Streaming Response."
* Key Advantage: It bypasses the need for external cloud storage or complex FTP setups for simple file handoffs, providing an immediate "Save As" experience for the user.

<figure><img src="/files/XwobuyLblgHY8nRs609A" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/FUFKDSAUH3vCqq0SKE9G" alt=""><figcaption></figcaption></figure>

## Blueprint Breakdown

The logic in the provided screenshot follows a linear flow: **Path Construction → Action Execution → File Loading → Frontend Notification.**

**1. Set File Path Function**

Before a file can be sent, the engine must define exactly where it is being stored.

* Logic: The blueprint uses `Append` nodes to combine the Project Saved Directory with a specific folder name (e.g., `/Screenshots/`) and a dynamic filename.
* Flexibility: You can modify the string inputs here to point to any directory within your project’s write-accessible folders.

**2. Execute Console Command (Screenshot Capture)**

In this specific implementation, the flow triggers the engine's internal command to capture the viewport.

* Node: `Execute Console Command`.
* Command: Uses the file path generated in the previous step.
* Delay: A short `Delay` node (e.g., 0.2s) is often included to ensure the engine has finished writing the file to the disk before the next node attempts to read it.

**3. Load & Read File**

Once the file exists on the server's drive, it needs to be converted into a format the web browser can handle.

* Read File: The blueprint retrieves the file from the "Saved" path.
* Data Handling: The data is processed into a byte array or a format compatible with the Pixel Streaming communication component.

**4. Send Pixel Streaming Response**

This is the final "Handshake" with the Arcware Frontend.

* JSON Construction: The logic builds a JSON object containing a `type` (e.g., `"Screenshot"`) and the file data/URL.
* Send Response: The `Send Pixel Streaming Response` node broadcasts this message. The Arcware Frontend sees this "Notice," identifies the file, and triggers the browser's download prompt.

## Extending the Functionality

Because this is a Generic setup, you can replace the "Screenshot" logic with any other file-generating event:

| **File Type** | **UE Source Action** | **Use Case**                                              |
| ------------- | -------------------- | --------------------------------------------------------- |
| .txt / .json  | Save String to File  | Exporting user configuration or high scores.              |
| .csv          | Export Data Table    | Exporting analytics or product lists from a configurator. |
| .png / .jpg   | Render Target Export | Saving custom textures or UI snapshots.                   |

{% hint style="info" %}
**Note:** Always ensure the `Delay` node is sufficient for the file size being generated. Large files may require a "Success" callback rather than a static timer to prevent the "File Not Found" error during transfer.
{% endhint %}

## Working example

<https://codepen.io/Arcware/pen/rNEjdpV>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arcware.cloud/unreal-engine-setup/using-the-arcware-pixel-streaming-template-project/generic-file-transfer-from-ue-to-frontend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
