Description
This function saves a file in a directory and encodes it in a character set.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameters |
Type |
Description |
Possible values |
Example |
dir |
string |
The directory that contains the selected file. This parameter defaults to the user's /home directory. |
A valid directory name. |
public_html |
file |
string |
Required The files to retrieve. |
A valid filename. |
example.html |
from_charset |
string |
The character set encoding of the content parameter's value. This parameter defaults to UTF-8. |
Any cPanel-supportedcharacter encoding. |
UTF-8 |
to_charset |
string |
The character set encoding in which to encode the file. This parameter defaults to UTF-8. |
Any cPanel-supportedcharacter encoding. |
ASCII |
content |
string |
The new file's contents. If you do not use this parameter, the function creates a blank file. |
A string value. |
hi |
fallback |
Boolean |
Whether the function will return an error or save in the default character set if it cannot save in the specified character set. This parameter defaults to 1. |
|
0 |
Returns
Return |
Type |
Description |
Possible values |
Example |
path |
string |
The path to the file. |
A valid absolute file path. |
/home/user/public_html/example.html |
from_charset |
string |
The file's character set. |
Any cPanel-supported character set encoding. |
UTF-8 |
to_charset |
string |
The file's new character set. |
Any cPanel-supported character set encoding. |
ASCII |