# Save file

This function saves a file in a directory and encodes it in a character set.

Important:

  When you disable the File Storage role, the system disables this function.

Endpoint: GET /Fileman/save_file_content
Version: 11.136.0.4
Security: BasicAuth

## Query parameters:

  - `file` (string, required)
    The files to retrieve.
    Example: "example.html"

  - `content` (string)
    The new file's contents. If you do not use this parameter, the function creates a blank file.
    Example: "hi"

  - `dir` (string)
    The directory that contains the selected file.

Note:

This parameter defaults to the currently-authenticated user's /home directory.
    Example: "/home/username/public_html"

  - `fallback` (integer)
    Whether the function will return an error or save in the default
character set if it cannot save in the specified character set.

* 1 — Save in the default character set.
* 0 — Return an error.
    Enum: 0, 1

  - `from_charset` (string)
    The character set encoding of the content parameter's value.
    Example: "UTF-8"

  - `to_charset` (string)
    The character set encoding in which to encode the file.
    Example: "ASCII"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "save_file_content"

  - `module` (string)
    The name of the module called.
    Example: "Fileman"

  - `result` (object)

  - `result.data` (object)

  - `result.data.from_charset` (string)
    The file's character set.
    Example: "UTF-8"

  - `result.data.path` (string)
    The path to the file.
    Example: "/home/user/public_html/example.html"

  - `result.data.to_charset` (string)
    The file's new character set.
    Example: "ASCII"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    * 1 — Success.
* 0 — Failed. Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


