Fileman
Manage Files
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.
get/Fileman/save_file_content
Query parameters
filestring required
Example:example.html
The files to retrieve.
contentstring
Example:hi
The new file's contents. If you do not use this parameter, the function creates a blank file.
dirstring path
Example:/home/username/public_html
The directory that contains the selected file.
Note:
This parameter defaults to the currently-authenticated user's /home directory.
fallback0 | 1
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.
from_charsetstring
Example:UTF-8
The character set encoding of the content parameter's value.
to_charsetstring
Example:ASCII
The character set encoding in which to encode the file.
Response
HTTP Request was successful.
Example response
{
"apiversion": 3,
"func": "save_file_content",
"module": "Fileman",
"result": {
"data": {
"from_charset": "UTF-8",
"path": "/home/user/public_html/example.html",
"to_charset": "ASCII"
},
"status": 1
}
}