> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pdia-admin/9.3-administer/embed-and-extend-pentaho-functionality-cp/embed-pentaho-server-functionality-into-web-applications/publish-a-file-to-the-pentaho-server.md).

# Publish a file to the Pentaho Server

Follow this process if you want to publish a file to the Pentaho Server:

Click the link that publishes a file to the Pentaho Server: `http://localhost:8080/api/repo/publish/publishfile`. This publishes the file to the provided path in the repository. Note that the file will be overwritten if the overwrite flag is set to `true`.

| Name              | Description                                                                         | Type     | Default |
| ----------------- | ----------------------------------------------------------------------------------- | -------- | ------- |
| **pathId**        | (colon separated path for the repository file)                                      | formdata | false   |
| **fileContents**  | (input stream containing the data)                                                  | formdata | false   |
| **overwriteFile** | (flag to determine whether to overwrite the existing file in the repository or not) | formdata | false   |
| **fileInfo**      | (information about the file being imported)                                         | formdata | false   |

Sample code for reference purposes can be found at [Github for Pentaho](https://github.com/pentaho). Look for the file called `PublishRestUtil.java` under the **pentaho-reporting** repostitory.

The file is now published to the Pentaho Server and is available to users.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.pentaho.com/pdia-admin/9.3-administer/embed-and-extend-pentaho-functionality-cp/embed-pentaho-server-functionality-into-web-applications/publish-a-file-to-the-pentaho-server.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.
