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.
file required | string The files to retrieve. Example: file=example.html |
content | string The new file's contents. If you do not use this parameter, the function creates a blank file. Example: content=hi |
dir | string <path> The directory that contains the selected file. Note: This parameter defaults to the currently-authenticated user's Example: dir=/home/username/public_html |
fallback | integer Default: 1 Whether the function will return an error or save in the default character set if it cannot save in the specified character set.
Example: fallback=0 |
from_charset | string Default: "UTF-8" The character set encoding of the Example: from_charset=UTF-8 |
to_charset | string Default: "UTF-8" The character set encoding in which to encode the file. Example: to_charset=ASCII |
uapi --output=jsonpretty \ --user=username \ Fileman \ save_file_content \ file='example.html'
{- "apiversion": 3,
- "func": "save_file_content",
- "module": "Fileman",
- "result": {
- "data": {
- "from_charset": "UTF-8",
- "path": "/home/user/public_html/example.html",
- "to_charset": "ASCII"
}, - "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}