# SaveFileDialog

URL: https://docs.wisej.com/api/wisej.web/common-dialogs/wisej.web.savefiledialog

Version: 4.1
Namespace: **Wisej.Web**

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

- [CommonDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog)
- [FileDialog](/api/wisej.web/common-dialogs/wisej.web.filedialog)
- [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog)
Prompts the user to select a location for saving a file on the server.

- C# - VB.NET

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

```visual
Public Class SaveFileDialog
    Inherits FileDialog
```

You can:

- Override [PromptFileNotFound](/api/wisej.web/common-dialogs/wisej.web.filedialog) . It's called when the specified file doesn't exist and the property [CheckFileExists](/api/wisej.web/common-dialogs/wisej.web.filedialog#checkfileexists) is true.
- Override [PromptFileCreate](/api/wisej.web/common-dialogs/wisej.web.savefiledialog) . It's called when the specified file doesn't exist and the property [CreatePrompt](/api/wisej.web/common-dialogs/wisej.web.savefiledialog#createprompt) is true.
- Override [PromptFileOverwrite](/api/wisej.web/common-dialogs/wisej.web.savefiledialog) . It's called when the specified file doesn't exist and the property [OverwritePrompt](/api/wisej.web/common-dialogs/wisej.web.savefiledialog#overwriteprompt) is true.
- Override [CreateUI](/api/wisej.web/common-dialogs/wisej.web.filedialog#createui) to create your customForm when the method [ShowDialog](/api/wisej.web/common-dialogs/wisej.web.commondialog#showdialog) is called.
- Set the [DialogTemplate](/api/wisej.web/common-dialogs/wisej.web.commondialog#dialogtemplate) to aForm class that has a constructor that accepts [FileDialog](/api/wisej.web/common-dialogs/wisej.web.filedialog) as the single argument to change the User Interface (UI) of the file dialog.
- Override [OnFileOk](/api/wisej.web/common-dialogs/wisej.web.filedialog) 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) to the [Roots](/api/wisej.web/common-dialogs/wisej.web.filedialog#roots) collection before showing the dialog.

## Constructors

### ![Instance member](/img/api/instance.png) SaveFileDialog()

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

### ![Instance member](/img/api/instance.png) SaveFileDialog(container)

Initializes a new instance of the [SaveFileDialog](/api/wisej.web/common-dialogs/wisej.web.savefiledialog) 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) component. 

## Properties

### ![Instance member](/img/api/instance.png) 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` )

### ![Instance member](/img/api/instance.png) 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

### ![Instance member](/img/api/instance.png) 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#filename) is empty or null.

### ![Instance member](/img/api/instance.png) 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) 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.

### ![Protected member](/img/api/protected.png) 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.

### ![Protected member](/img/api/protected.png) 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.

### ![Instance member](/img/api/instance.png) Reset()

Resets all dialog box options to their default values.
