> For the complete documentation index, see [llms.txt](https://docs.wisej.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/api/wisej.web/common-dialogs/wisej.web.savefiledialog.md).

# SaveFileDialog

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [CommonDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog.md)
  * [FileDialog](/api/wisej.web/common-dialogs/wisej.web.filedialog.md)
    * [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog.md)

Prompts the user to select a location for saving a file on the server.

{% tabs %}
{% tab title="C#" %}

```csharp
public class SaveFileDialog : FileDialog
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class SaveFileDialog
    Inherits FileDialog
```

{% endtab %}
{% endtabs %}

You can:

* Override [PromptFileNotFound](/api/wisej.web/common-dialogs/wisej.web.filedialog.md#promptfilenotfound). It's called when the specified file doesn't exist and the property [CheckFileExists](/api/wisej.web/common-dialogs/wisej.web.filedialog.md#checkfileexists) is true.
* Override [PromptFileCreate](#promptfilecreate). It's called when the specified file doesn't exist and the property [CreatePrompt](#createprompt) is true.
* Override [PromptFileOverwrite](#promptfileoverwrite). It's called when the specified file doesn't exist and the property [OverwritePrompt](#overwriteprompt) is true.
* Override [CreateUI](/api/wisej.web/common-dialogs/wisej.web.filedialog.md#createui) to create your custom [Form](/api/wisej.web/containers/form.md) when the method [ShowDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog.md#showdialog) is called.
* Set the [DialogTemplate](/api/wisej.web/common-dialogs/wisej.web.commondialog.md#dialogtemplate) to a [Form](/api/wisej.web/containers/form.md) class that has a constructor that accepts [FileDialog](/api/wisej.web/common-dialogs/wisej.web.filedialog.md) as the single argument to change the User Interface (UI) of the file dialog.
* Override [OnFileOk](/api/wisej.web/common-dialogs/wisej.web.filedialog.md#onfileok) to provide your custom implementation of the actions to execute when the user presses the OK button.

You must add at least one [IFileSystemProvider](/api/wisej.core/general/wisej.core.ifilesystemprovider.md) to the [Roots](/api/wisej.web/common-dialogs/wisej.web.filedialog.md#roots) collection before showing the dialog.

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) SaveFileDialog()

Initializes a new instance of [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) SaveFileDialog(container)

Initializes a new instance of the [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog.md) extender with a specified container.

| Name          | Type                                                                                 | Description                                                                                                                                                                                                         |
| ------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **container** | [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) | An [IContainer](https://docs.microsoft.com/dotnet/api/system.componentmodel.icontainer) that represents the container of the [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog.md) component. |

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) CreatePrompt

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating whether the dialog box prompts the user for permission to create a file, if the file specified file does not exist. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) OverwritePrompt

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating whether the dialog box displays a warning if the user specifies a file name that already exists. (Default: `True`)

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) OpenFile()

Opens the file with read/write permission selected by the user.

**Returns:** [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream). A [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream) that specifies the read/write file selected by the user.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) [FileName](/api/wisej.web/common-dialogs/wisej.web.filedialog.md#filename) is empty or null.

### ![](/files/hsR4ok3152WyAf8J2C1u) ProcessFileNames(fileNames)

Receives the file names selected by the user and validates them according to the properties set in the [FileDialog](/api/wisej.web/common-dialogs/wisej.web.filedialog.md) instance.

| Parameter     | Type                                                              | Description                               |
| ------------- | ----------------------------------------------------------------- | ----------------------------------------- |
| **fileNames** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | Array containing the selected file paths. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). True if the files have been validated and the dialog can close; otherwise false to keep the dialog open.

### ![](/files/lzopMboA31bVq8UIcbT3) PromptFileCreate(fileName)

Asks the user's permission to create the specified *fileName* .

| Parameter    | Type                                                          | Description          |
| ------------ | ------------------------------------------------------------- | -------------------- |
| **fileName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | File name to create. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). True if the user confirms to create the file.

### ![](/files/lzopMboA31bVq8UIcbT3) PromptFileOverwrite(fileName)

Asks the user's permission to overwrite the specified *fileName* .

| Parameter    | Type                                                          | Description             |
| ------------ | ------------------------------------------------------------- | ----------------------- |
| **fileName** | [String](https://docs.microsoft.com/dotnet/api/system.string) | File name to overwrite. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). True if the user confirms to overwrite the file.

### ![](/files/hsR4ok3152WyAf8J2C1u) Reset()

Resets all dialog box options to their default values.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/common-dialogs/wisej.web.savefiledialog.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
