Description
This function creates a file.
Warning:
We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
name |
string |
Required The new file's name. |
A valid file name. |
new_file.html |
path |
string |
Required The new file's path. |
The absolute path to a location on the server. |
/home/user/public_html/ |
permissions |
string |
The new file's permissions. This value defaults to0644. |
A valid octal string. |
0755 |
Returns
Return |
Type |
Description |
Possible values |
Example |
permissions |
string |
The new file's permissions. |
A valid octal string. |
0755 |
name |
string |
The name of the new file. |
A valid file name. |
new_file |
path |
string |
The path to the new file. |
A valid file path, relative to the user's homedirectory. |
/home/example/public_html |
reason |
string |
A reason for failure. Note: This function only returns a reason value if an error occurred. |
A string that describes the error. |
This is an error message. |
result |
Boolean |
Whether the function succeeded. |
|
1 |